@Override
    protected final void die(Throwable cause) {
      super.die(cause);
      if (ctx.channel().isOpen()) ctx.close();

      // Ensure to release server references
      userActor = null;
      ctx = null;
    }
 @Override
 public final void close() {
   if (ctx.channel().isOpen()) ctx.close();
   if (actor != null) actor.die(null);
 }
 @Override
 public final void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
   if (ctx.channel().isOpen()) ctx.close();
   log.error("Exception caught", cause);
 }