@Override public void channelActive(ChannelHandlerContext ctx) { final Channel c = ctx.channel(); Session s = connectionManager.newSession(c); if (!session.compareAndSet(null, s)) { throw new IllegalStateException("Session may not be set more than once"); } s.onReady(); }
@Override public void channelInactive(ChannelHandlerContext ctx) { Session session = this.session.get(); session.onDisconnect(); }