code: private static Result<?> decodeVariableHeader(ByteBuf buffer, MqttFixedHeader mqttFixedHeader) {
          switch (mqttFixedHeader.messageType()) {
              case CONNECT:
                  return decodeConnectionVariableHeader(buffer);
  
              case CONNACK:
                  return decodeConnAckVariableHeader(buffer);
  
              case SUBSCRIBE:
              case UNSUBSCRIBE:
              case SUBACK:
              case UNSUBACK:
              case PUBACK:
              case PUBREC:
              case PUBCOMP:
              case PUBREL:
                  return decodeMessageIdVariableHeader(buffer);
  
              case PUBLISH:
                  return decodePublishVariableHeader(buffer, mqttFixedHeader);
  
              case PINGREQ:
              case PINGRESP:
              case DISCONNECT:
                  // Empty variable header
                  return new Result<Object>(null, 0);
          }
          return new Result<Object>(null, 0); //should never reach here
      }
docs: Decodes the variable header (if any)
  @param buffer the buffer to decode from
  @param mqttFixedHeader MqttFixedHeader of the same message
  @return the variable header