@Override
public void channelRead(final ChannelHandlerContext ctx, Object buf) {
if (server3OutboundChannel.isActive()) {
server3OutboundChannel.writeAndFlush(msg)
.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) {
if (future.isSuccess()) {
// was able to flush out data, start to read the next chunk
System.out.println(server3OutboundChannel.bytesBeforeUnwritable());
ctx.channel().read();
} else {
future.channel().close();
}
}
});
}
}i checked after running a test-case by completely blocking the receive in the server. netty is basically used as a proxy between the client and server. The client kept sending a message in a loop and the message was also printed out to System.out along with a counter. The client eventually stops sending any more messages. The proxy keeps forwarding these messages and "never" becomes unwritable, nor does the bytebeforeunwritable decrease |