@Override
    protected void encode(ChannelHandlerContext ctx, ByteBuf outBB, List<Object> list) {
        if ((embedCtx == null) && (ctx.channel() instanceof EmbeddedChannel)) embedCtx = ctx;
        if ((tcpChannel != null) && (embedCtx == ctx)) {
            tcpChannel.writeAndFlush(outBB.copy());
        }
        list.add(outBB.copy());
    }
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