8078348: sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java fails with BindException
authorvinnie
Wed, 22 Apr 2015 14:01:01 +0100
changeset 29983 244149c6b998
parent 29982 fb8a09dc77e6
child 29984 2d0af02e9add
8078348: sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java fails with BindException Reviewed-by: xuelei
jdk/test/sun/security/pkcs11/sslecc/CipherTest.java
jdk/test/sun/security/pkcs11/sslecc/JSSEServer.java
--- a/jdk/test/sun/security/pkcs11/sslecc/CipherTest.java	Wed Apr 22 02:23:06 2015 +0300
+++ b/jdk/test/sun/security/pkcs11/sslecc/CipherTest.java	Wed Apr 22 14:01:01 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
 public class CipherTest {
 
     // use any available port for the server socket
-    static int serverPort = 0;
+    static volatile int serverPort = 0;
 
     final int THREADS;
 
--- a/jdk/test/sun/security/pkcs11/sslecc/JSSEServer.java	Wed Apr 22 02:23:06 2015 +0300
+++ b/jdk/test/sun/security/pkcs11/sslecc/JSSEServer.java	Wed Apr 22 14:01:01 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
         serverContext.init(new KeyManager[] {cipherTest.keyManager}, new TrustManager[] {cipherTest.trustManager}, cipherTest.secureRandom);
 
         SSLServerSocketFactory factory = (SSLServerSocketFactory)serverContext.getServerSocketFactory();
-        serverSocket = (SSLServerSocket)factory.createServerSocket(cipherTest.serverPort);
+        serverSocket = (SSLServerSocket)factory.createServerSocket(0);
         cipherTest.serverPort = serverSocket.getLocalPort();
         serverSocket.setEnabledCipherSuites(factory.getSupportedCipherSuites());
         serverSocket.setWantClientAuth(true);