ByteBuf buf = channel.unsafe().directOutboundContext().outboundByteBuffer();
if (buf.refCnt() == 0) {
return;
}
buf.resumeIntermediaryDeallocations();
int writtenBytes = result.intValue();
if (writtenBytes > 0) {
// Update the readerIndex with the amount of read bytes
buf.readerIndex(buf.readerIndex() + writtenBytes);