@Override
    public void close() {
        try {
            if (serverSocket != null) {
                serverSocket.close();
            }
            if (socket != null) {
                socket.close();
            }
        } catch (final IOException ignore) {
        }

        if (throwable != null) {
            throw new RuntimeException("Exception thrown while TlsHandshakeTimerOuter was running", throwable);
        } else if (!requestReceived) {
            throw new IllegalStateException("Never received a request");
        }
    }
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