@Override
 public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
   // as seen in http://www.jboss.org/netty/community.html#nabble-td2423020
   super.channelOpen(ctx, e);
   if (group != null) {
     group.add(ctx.getChannel());
   }
 }
 @Override
 public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
   if (e.getCause() instanceof JsonParseException) {
     BaseTransport.respond(
         e.getChannel(), HttpResponseStatus.INTERNAL_SERVER_ERROR, "Broken JSON encoding.");
   } else if (e.getCause() instanceof SessionHandler.NotFoundException) {
     BaseTransport.respond(
         e.getChannel(),
         HttpResponseStatus.NOT_FOUND,
         "Session not found. Cannot send data to non-existing session.");
   } else {
     super.exceptionCaught(ctx, e);
   }
 }