There is a project that wants to transition from mina to netty, but involves IoSession as a local session. So how to implement a similar session in Netty for use。
private IoSession _session;
if (immediately) {
_session.closeNow();
}else{
_session.closeOnFlush();
}
How to better implement this function
I guess it would be something like:
private ChannnelHandlerContext ctx;
if (immediately) {
ctx.close();
} else {
ctx.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
}