@Override
    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
        logger.info(LocalTime.now() + " userEventTriggered: " + ctx.name() + " Event: " + evt);

        if (evt instanceof ConnectedEvent) {
            try {
                ChannelHandler watchdog = tcpChannel.pipeline().get("watchdog");
                if (watchdog != null) {
                    tcpChannel.pipeline().remove(watchdog);
                }

            } catch (Exception ex) {
                logger.info(ex.toString());
            }
            try {
                if ((embededChannel.attr(READ_TIME_OUT).get() > 0) &&
                    embededChannel.attr(IS_PING_ACTIVE).get())
                    tcpChannel.pipeline().addFirst("watchdog",
                        new ReadTimeoutHandler(embededChannel.attr(READ_TIME_OUT).get()));
                if (tcpChannel.isActive()) {
                    embededChannel.attr(IS_CONNECTED).set(true);
                } else {
                    embededChannel.attr(IS_CONNECTED).set(false);
                }
            } catch (Exception ex) {
                logger.info(ex.toString());
            }
        }

        if (evt instanceof DisconnectEvent) {
//            logger.info("userEventTriggered -> DisconnectEvent");
        }
        
        // trigger other event handlers after IS_CONNECTED was set
        super.userEventTriggered(ctx, evt);
    }
Implementation of a multiplexing channel, from an embedded channel to two
possible TCP connections, primary and secondary.
The objective is to allow connections to individual systems
with a two CP (PN CPUs, CP343-1, CP443-1 or similar), or H-type systems
(S7-400H or S7-1500H).
The user App must be in charge of restoring the requests or
subscriptions that it is requesting.
plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7HMuxImpl.java