Try using out.writerIndex instead of readerIndex