@Override
 public ByteBuf toByteArray() throws MessageEncodingException {
   ByteBuf buffer = createChannelBufferWithHeader();
   ByteBuf msgBuffer = message.toByteArray();
   byte[] bytes = msgBuffer.array();
   buffer.writeBytes(bytes);
   return buffer;
 }
 @Override
 public ByteBuf toByteArray() throws MessageEncodingException {
   ByteBuf buffer = createChannelBufferWithHeader();
   ByteBuf msgBuffer = message.toByteArray();
   // Could use ByteBuffer instead of byte[], but it's not
   // guaranteed to be same buffer as used in ChannelBuffer
   byte[] bytes = msgBuffer.array();
   buffer.writeBytes(bytes);
   return buffer;
 }