Scaling outbound writes

But you seem to be writing ByteBuffers into the pipeline, right? That suggests that the data is already encoded but then I don’t quite understand what you’re doing with the MessageToByteEncoder.

I think the crash you’re seeing is MessageToByteEncoder expecting a Payload but receiving a ByteBuffer. Are you trying to add extra framing with your MessageToByteEncoder maybe?

Btw, you don’t need the NIOAny(buffer), you can just do channel.writeAndFlush(buffer).