private SSLEngine initHandshake() throws Exception {
        final SSLContext sslContext = SSLTestContexts.createServerSSLContext();
        final SSLEngine sslEngine = sslContext.createSSLEngine();
        // TLSv1.2 always uses a four-way handshake, which is what we want
        sslEngine.setEnabledProtocols(new String[]{ "TLSv1.2" });
        sslEngine.setUseClientMode(false);
        sslEngine.setNeedClientAuth(false);

        sslEngine.beginHandshake();
        return sslEngine;
    }
This test server accepts a single TLS connection request, which will then time out. The server can run in two modes.
If {@code sendServerHello} is false, the Client Hello message will be swallowed, and the client will time out while
waiting for the Server Hello record. Else, the server will respond to the Client Hello with a Server Hello, and the
client's connection attempt will subsequently time out while waiting for the Change Cipher Spec record from the
server.
httpclient5-testing/src/test/java/org/apache/hc/client5/testing/tls/TlsHandshakeTimeoutServer.java