@Override
    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
        String remoteAddress = RemotingUtil.parseRemoteAddress(ctx.channel());
        infoLog("Connection channel inactive: {}", remoteAddress);
        super.channelInactive(ctx);
        Attribute attr = ctx.channel().attr(Connection.CONNECTION);
        if (null != attr) {
            Connection conn = (Connection) attr.get();
            // if conn is null, means that channel has been inactive before binding with connection
            // this situation will fire a CLOSE event in ConnectionFactory
            if (conn != null) {
                userEventTriggered(ctx, ConnectionEventType.CLOSE);
            }
        }
    }
@see io.netty.channel.ChannelInboundHandlerAdapter#channelRegistered(io.netty.channel.ChannelHandlerContext)
src/main/java/com/alipay/remoting/ConnectionEventHandler.java