docs: @Override
      public void sendPacket(ProtocolHeader header, Protocol protocol) throws IOException {
          SocketChannel sock = (SocketChannel) selectionKey.channel();
          if (sock == null) {
              throw new IOException("Socket is null!");
          }
  
          ByteArrayOutputStream baos = null;
          try {
              baos = new ByteArrayOutputStream();
              ObjectOutputStream oos = new ObjectOutputStream(baos);
              oos.writeObject(header);
              oos.writeObject(protocol);
  
              StringBuilder sb = new StringBuilder("Create ByteBuffer, RequestHeader[");
              if(header != null){
                  sb.append("xid=").append(header.getXid());
                  sb.append(", Type=").append(header.getType());
              }else{
                  sb.append("NULL");
              }
              sb.append("], Request[");
              if(protocol != null){
                  sb.append(protocol.getClass().getName());
              } else {
                  sb.append("NULL");
              }
              sb.append("]");
              if(LOGGER.isTraceEnabled()){
                  LOGGER.trace(sb.toString());
              }
  
              byte[] bytes = baos.toByteArray();
              int l = bytes.length + 4;
              ByteBuffer bb = ByteBuffer.allocate(l);
              bb.putInt(bytes.length);
              bb.put(bytes);
              if(LOGGER.isTraceEnabled()){
                  LOGGER.trace(".................Send packet, xid=" + header.getXid() + ", type=" + header.getType());
              }
              bb.flip();
              sock.write(bb);
          } catch (IOException e) {
              LOGGER.warn("Ignoring unexpected exception", e);
          } finally {
              try {
                  if(baos != null){
                      baos.close();
                  }
              } catch (IOException e) {
                  // do nothing.
              }
          }
  
      }