test/jdk/sun/security/ssl/SSLSocketImpl/NoImpactServerRenego.java
changeset 50768 68fa3d4026ea
parent 47216 71c04702a3d5
--- a/test/jdk/sun/security/ssl/SSLSocketImpl/NoImpactServerRenego.java	Mon Jun 25 21:22:16 2018 +0300
+++ b/test/jdk/sun/security/ssl/SSLSocketImpl/NoImpactServerRenego.java	Mon Jun 25 13:41:39 2018 -0700
@@ -28,12 +28,19 @@
  * @test
  * @bug 7188658
  * @summary Add possibility to disable client initiated renegotiation
- * @run main/othervm
- *      -Djdk.tls.rejectClientInitiatedRenegotiation=true NoImpactServerRenego
+ * @run main/othervm  -Djdk.tls.rejectClientInitiatedRenegotiation=true
+ *      NoImpactServerRenego SSLv3
+ * @run main/othervm  -Djdk.tls.rejectClientInitiatedRenegotiation=true
+ *      NoImpactServerRenego TLSv1
+ * @run main/othervm  -Djdk.tls.rejectClientInitiatedRenegotiation=true
+ *      NoImpactServerRenego TLSv1.1
+ * @run main/othervm  -Djdk.tls.rejectClientInitiatedRenegotiation=true
+ *      NoImpactServerRenego TLSv1.2
  */
 
 import java.io.*;
 import java.net.*;
+import java.security.Security;
 import javax.net.ssl.*;
 
 public class NoImpactServerRenego implements
@@ -157,6 +164,7 @@
             (SSLSocketFactory) SSLSocketFactory.getDefault();
         SSLSocket sslSocket = (SSLSocket)
             sslsf.createSocket("localhost", serverPort);
+        sslSocket.setEnabledProtocols(new String[] { tlsProtocol });
 
         InputStream sslIS = sslSocket.getInputStream();
         OutputStream sslOS = sslSocket.getOutputStream();
@@ -187,6 +195,9 @@
     volatile Exception serverException = null;
     volatile Exception clientException = null;
 
+    // the specified protocol
+    private static String tlsProtocol;
+
     public static void main(String[] args) throws Exception {
         String keyFilename =
             System.getProperty("test.src", "./") + "/" + pathToStores +
@@ -200,8 +211,13 @@
         System.setProperty("javax.net.ssl.trustStore", trustFilename);
         System.setProperty("javax.net.ssl.trustStorePassword", passwd);
 
-        if (debug)
+        if (debug) {
             System.setProperty("javax.net.debug", "all");
+        }
+
+        Security.setProperty("jdk.tls.disabledAlgorithms", "");
+
+        tlsProtocol = args[0];
 
         /*
          * Start the tests.