docs: ChannelBuffer buffer() throws IOException {
      ChannelBufferOutputStream bout =
        new ChannelBufferOutputStream(ChannelBuffers.directBuffer(encoded_length));
  
      try {
        for (TaskMessage msg : messages) {
          writeTaskMessage(bout, msg);
        }
        return bout.buffer();
      } catch (IOException e) {
        log.error("Error while writing Tasks to Channel Buffer - {}", e.getMessage());
      } finally {
        Closeables.close(bout, false);
      }
      return null;
    }