code: public static ByteBuf serialize(final Serializable serializable) throws Exception {
          ByteArrayOutputStream bos = new ByteArrayOutputStream();;
          ObjectOutputStream os = new ObjectOutputStream(bos);
          os.writeObject(serializable);
  
          byte[] serialized = bos.toByteArray();
          os.close();
          bos.close();
          return Unpooled.buffer().writeBytes(serialized);
      }
docs: Serializes the input into a ByteBuf.
  
  @param serializable the object to serialize.
  @return the serialized object.
  @throws Exception if something goes wrong during serialization.