code: public ByteBuffer encode(Packet packet, GroupContext groupContext, ChannelContext channelContext) {
          SimplePacket helloPacket  = (SimplePacket) packet;
          byte[] body = helloPacket.getBody();
          int bodyLen = 0;
          if(body != null){
              bodyLen = body.length;
          }
  
          //Bytebuffer总长度 = 消息头+消息体的长度
          int allLen = SimplePacket.HEADER_LENGTH+bodyLen;
          //创建新的Bytebuffer
          ByteBuffer buf = ByteBuffer.allocate(allLen);
          //设置字节序
          buf.order(groupContext.getByteOrder());
          //写入消息头
          buf.putInt(bodyLen);
          //写入消息体
          if(body != null){
              buf.put(body);
          }
          return buf;
      }
docs: 编码:将业务数据编码成可以发送的ByteBuffer
  总的消息结构: 消息头+ 消息体
  消息头结构:4个字节,存储消息体的长度
  消息体结构:业务json串的byte[]
  @param packet
  @param groupContext
  @param channelContext
  @return