@Override
    public void connect() throws PlcConnectionException {
        try {
            // As we don't just want to wait till the connection is established,
            // define a future we can use to signal back that the s7 session is
            // finished initializing.
            CompletableFuture<Void> sessionSetupCompleteFuture = new CompletableFuture<>();
            CompletableFuture<PlcConnectionConfiguration> sessionDiscoveredCompleteFuture = new CompletableFuture<>();

            if (channelFactory == null) {
                throw new PlcConnectionException("No primary channel factory provided");
            }

            // Inject the configuration
            ConfigurationFactory.configure(configuration, channelFactory);

            if (secondaryChannelFactory != null) {
                ConfigurationFactory.configure(configuration, secondaryChannelFactory);
            }

            if (null == channel) {
                channel = new EmbeddedChannel(
                    getChannelHandler(sessionSetupCompleteFuture,
                        sessionDisconnectCompleteFuture,
                        sessionDiscoveredCompleteFuture));
                channel.pipeline().removeLast();
                channel.pipeline().addFirst("Multiplexor", s7hmux);

            }

            ((S7HMux) s7hmux).setEmbededhannel(channel, configuration);
            //channel.pipeline().addFirst((new LoggingHandler("CEOS"))); 
            /*
            channel.closeFuture().addListener(future -> {
                if (!sessionSetupCompleteFuture.isDone()) {
                    sessionSetupCompleteFuture.completeExceptionally(
                        new PlcIoException("Connection terminated by remote"));
                }
            });
            */
            doPrimaryTcpConnections();

            if (secondaryChannelFactory != null) {
                doSecondaryTcpConnections();
            }

            //If it is not possible to generate a TCP connection.
            //Safety shutdown all executors in the channels.
            if (primaryChannel == null) {
                if (secondaryChannel == null) {
                    sendChannelDisconectEvent();
                    throw new PlcConnectionException("Connection is not possible.");
                }
            }

            scf = executor.scheduleAtFixedRate(this, 1, 1, TimeUnit.SECONDS); 
            
            /*            
            primary_channel.closeFuture().addListener(future -> {/watch?v=TmENMZFUU_0&list=RDlBlx1JffMQ4&index=27
                if (!sessionDiscoveredCompleteFuture.isDone()) {
                    //Do Nothing
                    try {
                        sessionDiscoveredCompleteFuture.complete(null);
                    } catch (Exception e) {
                        //Do Nothing
                    }

                }
            });            
            */

            // Send an event to the pipeline telling the Protocol filters what's going on.
            sendChannelCreatedEvent();

            // Wait till the connection is established.
            if (awaitSessionSetupComplete) {
                sessionSetupCompleteFuture.get();
            }
            //channel.pipeline().write(new ConnectedEvent());
            // Set the connection to "connected"
            connected = true;
            //((EmbeddedChannel) channel).runPendingTasks();
        } catch (InterruptedException e) {
            logger.error(e.getMessage());
            Thread.currentThread().interrupt();
            throw new PlcConnectionException(e);
        } catch (ExecutionException e) {
            logger.error(e.getMessage());            
            throw new PlcConnectionException(e);
        }
    }
This object generates the main connection and includes the management
of multiple connections to the PLC, in the case of S7H there
are two connections.
Here the reference to the multiplexer object (S7HMuxImpl) is maintained,
which is in charge of managing the physical TCP connections.
<p>
TODO: It should be able to run in the "channel" executor.
You should be able to remove the "executor".
plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7HPlcConnection.java