code: @Override
      public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
          endpoint.onDisconnected();
          super.channelClosed(ctx, e);
      }
docs: of those events comes, even though the channelConnected came. Using just channelClosed appears to be reliable.