The custom protocol encoder makes a data copy here: https://github.com/NiteshKant/netty-playground/blob/master/custom-protocol/src/main/java/com/netflix/custom/protocol/CustomProtocolEncoder.java#L44
Instead it can use a composite buffer to create the data, reusing the ByteBuffer that the attribute contains.
The custom protocol encoder makes a data copy here: https://github.com/NiteshKant/netty-playground/blob/master/custom-protocol/src/main/java/com/netflix/custom/protocol/CustomProtocolEncoder.java#L44
Instead it can use a composite buffer to create the data, reusing the ByteBuffer that the attribute contains.