@Test(expected = SocketTimeoutException.class)
  public void handshakeWithPeerCanTimeout() throws Throwable {
    ServerSocketChannel serverChannel = ServerSocketChannel.open();
    serverSocket = serverChannel.socket();

    InetSocketAddress addr = new InetSocketAddress(localHost, 0);
    serverSocket.bind(addr, 10);
    int serverPort = serverSocket.getLocalPort();

    serverThread = startServerNIO(serverSocket, 1000);

    Socket socket = new Socket();
    await().atMost(5, TimeUnit.MINUTES).until(() -> {
      try {
        socket.connect(new InetSocketAddress(localHost, serverPort));
      } catch (ConnectException e) {
        return false;
      } catch (SocketException e) {
        return true; // server socket was closed
      }
      return true;
    });
    await().untilAsserted(() -> assertFalse(serverThread.isAlive()));
    assertNotNull(serverException);
    throw serverException;
  }
see GEODE-4087. Geode should not establish a default SSLContext, preventing apps from using
different ssl settings via standard system properties. Since this test class sets these system
properties to establish a default context we merely need to perform an equality check between
the cluster's context and the default context and assert that they aren't the same.
geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java