I am working on upgrading an application using Netty 3 to Netty 4. A lot of the handlers currently have code that look like this:
public class SomeHandler extends SimpleChannelUpstreamHandler {
@Override
public void channelOpen(final ChannelHandlerContext ctx, final ChannelStateEvent e) {
// do stuff with input
// ....
// then call the sendUpstream method
ctx.sendUpstream(e);
}
}
I am looking how to convert this to Netty 4. I see that ChannelOutboundHandlerAdapter
replaces SimpleChannelUpstreamHandler
now, but still couple of questions:
ChannelStateEvent
is no longer available in Netty 4, what is the mechanism to receive channel events now?ctx.sendUpstream(e)
doing there, and how can that be replicated in Netty 4?you would override channelActive(...)
in this case and call ctx.fireChannelActive()
as a replacement for sendUpstream(...)