Пример #1
0
 @Override
 public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e)
     throws Exception {
   Session session = new Session(ctx.getChannel());
   netHandler.onConnected(session);
   ctx.setAttachment(session);
 }
Пример #2
0
 @Override
 public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
   netHandler.exceptionCaught((Session) ctx.getAttachment(), e.getCause());
 }
Пример #3
0
 @Override
 public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
   NetMessage message = (NetMessage) e.getMessage();
   message.setSession((Session) ctx.getAttachment());
   netHandler.messageReceived(message);
 }
Пример #4
0
 @Override
 public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
   netHandler.onClosed((Session) ctx.getAttachment());
 }