8021418: Intermittent: SSLSocketSSLEngineTemplate.java test fails with timeout
Reviewed-by: xuelei, wetmore
Contributed-by: rajan.halade@oracle.com
diff --git a/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java b/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java
index 7e97d8e..16696db 100644
--- a/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java
+++ b/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java
@@ -206,7 +206,9 @@
     private void runTest(boolean direct) throws Exception {
         boolean serverClose = direct;
 
-        serverSocket = new ServerSocket(0);
+        serverSocket = new ServerSocket();
+        serverSocket.setReuseAddress(false);
+        serverSocket.bind(null);
         int port = serverSocket.getLocalPort();
         Thread thread = createClientThread(port, serverClose);