### CI Link

https://gradle-enterprise.elastic.co/s/m2bt2a5nnfqoo

### Repro line

./gradlew ':x-pack:plugin:security:test' --tests "org.elasticsearch.xpack.security.transport.netty4.SimpleSecurityNetty4ServerTransportTests.testTimeoutPerConnection" -Dtests.seed=47A68B48AEA74E00 -Dtests.locale=sq -Dtests.timezone=Asia/Bahrain

### Does it reproduce?

Yes

### Applicable branches

main

### Failure history

The test only runs on OSX or BSD. So it fails when running it on a Mac.

### Failure excerpt

```  
> org.elasticsearch.transport.ConnectTransportException: [][192.168.0.52:65029] connect_exception
        at __randomizedtesting.SeedInfo.seed([47A68B48AEA74E00:871946D2DD622841]:0)
        at app//org.elasticsearch.transport.TcpTransport$ChannelsConnectedListener.onFailure(TcpTransport.java:1151)
        at app//org.elasticsearch.action.ActionListener.completeWith(ActionListener.java:502)
        at app//org.elasticsearch.common.util.concurrent.ListenableFuture.notifyListenerDirectly(ListenableFuture.java:111)
        at app//org.elasticsearch.common.util.concurrent.ListenableFuture.done(ListenableFuture.java:100)
        at app//org.elasticsearch.common.util.concurrent.BaseFuture.setException(BaseFuture.java:149)
        at app//org.elasticsearch.common.util.concurrent.ListenableFuture.onFailure(ListenableFuture.java:139)
        at app//org.elasticsearch.transport.netty4.Netty4TcpChannel.lambda$addListener$0(Netty4TcpChannel.java:62)
        at app//io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590)
        at app//io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:583)
        at app//io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:559)
        at app//io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492)
        at app//io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636)
        at app//io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:629)
        at app//io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:118)
        at app//org.elasticsearch.xpack.core.security.transport.netty4.SecurityNetty4Transport$ClientSslHandlerInitializer.lambda$connect$0(SecurityNetty4Transport.java:273)
        at app//io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590)
        at app//io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:583)
        at app//io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:559)
        at app//io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492)
        at app//io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636)
        at app//io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:629)
        at app//io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:118)
        at app//io.netty.handler.ssl.SslHandler$7.run(SslHandler.java:2118)
        at app//io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98)
        at app//io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:153)
        at app//io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
        at app//io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
        at app//io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
        at app//io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
        at app//io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
        at app//io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at java.base@19.0.2/java.lang.Thread.run(Thread.java:1589)

        Caused by:
        org.elasticsearch.common.util.concurrent.UncategorizedExecutionException: Failed execution
            at app//org.elasticsearch.common.util.concurrent.FutureUtils.rethrowExecutionException(FutureUtils.java:80)
            at app//org.elasticsearch.common.util.concurrent.FutureUtils.get(FutureUtils.java:72)
            at app//org.elasticsearch.common.util.concurrent.ListenableFuture.lambda$notifyListenerDirectly$0(ListenableFuture.java:111)
            at app//org.elasticsearch.action.ActionListener.completeWith(ActionListener.java:499)
            ... 30 more

            Caused by:
            java.util.concurrent.ExecutionException: io.netty.handler.ssl.SslHandshakeTimeoutException: handshake timed out after 10000ms
                at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.getValue(BaseFuture.java:257)
                at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:231)
                at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:53)
                at org.elasticsearch.common.util.concurrent.FutureUtils.get(FutureUtils.java:65)
                ... 32 more

                Caused by:
                io.netty.handler.ssl.SslHandshakeTimeoutException: handshake timed out after 10000ms
                    at app//io.netty.handler.ssl.SslHandler$7.run(SslHandler.java:2115)
                    ... 9 more
```
modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/SimpleNetty4TransportTests.java
}
        }
    }
    public void testTransportProfile() {
        final String transportProfile = randomFrom(
            TransportSettings.DEFAULT_PROFILE,
            RemoteClusterPortSettings.REMOTE_CLUSTER_PROFILE,
            randomAlphaOfLengthBetween(5, 12)
        );
        final ConnectionProfile connectionProfile = ConnectionProfile.resolveConnectionProfile(
            new ConnectionProfile.Builder().setTransportProfile(transportProfile)
                .addConnections(
                    1,
                    TransportRequestOptions.Type.BULK,
                    TransportRequestOptions.Type.PING,
                    TransportRequestOptions.Type.RECOVERY,
                    TransportRequestOptions.Type.REG,
                    TransportRequestOptions.Type.STATE
                )
                .build(),
            TestProfiles.LIGHT_PROFILE
        );
        try (
            MockTransportService serviceC = buildService("TS_C", Version.CURRENT, Settings.EMPTY);
            MockTransportService serviceD = buildService("TS_D", Version.CURRENT, Settings.EMPTY)
        ) {
            try (Transport.Connection connection = openConnection(serviceC, serviceD.getLocalDiscoNode(), connectionProfile)) {
                assertThat(connection, instanceOf(StubbableTransport.WrappedConnection.class));
                Transport.Connection conn = ((StubbableTransport.WrappedConnection) connection).getConnection();
                assertThat(conn, instanceOf(TcpTransport.NodeChannels.class));