示例#1
0
 @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();
 }
示例#2
0
 @Override
 public void channelInactive(ChannelHandlerContext ctx) {
   Session session = this.session.get();
   session.onDisconnect();
 }