code: public static void encodeHeaderByte(IoBuffer out, byte headerSize, int channelId) {
          if (channelId <= 63) {
              out.put((byte) ((headerSize << 6) + channelId));
          } else if (channelId <= 319) {
              out.put((byte) (headerSize << 6));
              out.put((byte) (channelId - 64));
          } else {
              out.put((byte) ((headerSize << 6) | 1));
              channelId -= 64;
              out.put((byte) (channelId & 0xff));
              out.put((byte) (channelId >> 8));
          }
      }
docs: Encodes header size marker and channel id into header marker.
  
  @param out output buffer
  @param headerSize Header size marker
  @param channelId Channel used