@Override
    public void userEventTriggered(ChannelHandlerContext ctx, Object event) throws Exception {
        if (event instanceof ConnectionEventType) {
            ConnectionEventType eventType = (ConnectionEventType) event;
            Channel channel = ctx.channel();
            if (channel == null) {
                logger
                    .warn(
                        "channel null when handle user triggered event in ConnectionEventHandler! eventType: {}",
                        eventType.name());
                return;
            }

            Connection connection = channel.attr(Connection.CONNECTION).get();
            if (connection == null) {
                logger
                    .error(
                        "[BUG]connection is null when handle user triggered event in ConnectionEventHandler! eventType: {}",
                        eventType.name());
                return;
            }

            final String remoteAddress = RemotingUtil.parseRemoteAddress(ctx.channel());
            final String localAddress = RemotingUtil.parseLocalAddress(ctx.channel());
            logger.info("trigger user event, local[{}], remote[{}], event: {}", localAddress,
                remoteAddress, eventType.name());

            switch (eventType) {
                case CONNECT:
                    onEvent(connection, connection.getUrl().getOriginUrl(),
                        ConnectionEventType.CONNECT);
                    break;
                case CONNECT_FAILED:
                case CLOSE:
                case EXCEPTION:
                    submitReconnectTaskIfNecessary(connection.getUrl());
                    onEvent(connection, connection.getUrl().getOriginUrl(), eventType);
                    break;
                default:
                    logger.error("[BUG]unknown event: {}", eventType.name());
                    break;
            }
        } else {
            super.userEventTriggered(ctx, event);
        }
    }
@see io.netty.channel.ChannelInboundHandlerAdapter#channelRegistered(io.netty.channel.ChannelHandlerContext)
src/main/java/com/alipay/remoting/ConnectionEventHandler.java