http-client-branch: prepare tests for TLS1.3 http-client-branch
authorchegar
Tue, 19 Jun 2018 09:13:58 +0100
branchhttp-client-branch
changeset 56771 73a6534bce94
parent 56770 f1626bc0a010
child 56772 38a290eb60eb
http-client-branch: prepare tests for TLS1.3 Contributed-by: michaelm
test/jdk/java/net/httpclient/AsFileDownloadTest.java
test/jdk/java/net/httpclient/BasicRedirectTest.java
test/jdk/java/net/httpclient/ConcurrentResponses.java
test/jdk/java/net/httpclient/CookieHeaderTest.java
test/jdk/java/net/httpclient/CustomRequestPublisher.java
test/jdk/java/net/httpclient/CustomResponseSubscriber.java
test/jdk/java/net/httpclient/DependentActionsTest.java
test/jdk/java/net/httpclient/DependentPromiseActionsTest.java
test/jdk/java/net/httpclient/EncodedCharsInURI.java
test/jdk/java/net/httpclient/EscapedOctetsInURI.java
test/jdk/java/net/httpclient/FlowAdapterPublisherTest.java
test/jdk/java/net/httpclient/FlowAdapterSubscriberTest.java
test/jdk/java/net/httpclient/HandshakeFailureTest.java
test/jdk/java/net/httpclient/ImmutableFlowItems.java
test/jdk/java/net/httpclient/InvalidInputStreamSubscriptionRequest.java
test/jdk/java/net/httpclient/InvalidSSLContextTest.java
test/jdk/java/net/httpclient/InvalidSubscriptionRequest.java
test/jdk/java/net/httpclient/LineBodyHandlerTest.java
test/jdk/java/net/httpclient/MappingResponseSubscriber.java
test/jdk/java/net/httpclient/MaxStreams.java
test/jdk/java/net/httpclient/NonAsciiCharsInURI.java
test/jdk/java/net/httpclient/RedirectMethodChange.java
test/jdk/java/net/httpclient/RedirectWithCookie.java
test/jdk/java/net/httpclient/ResponsePublisher.java
test/jdk/java/net/httpclient/RetryWithCookie.java
test/jdk/java/net/httpclient/ShortResponseBody.java
test/jdk/java/net/httpclient/SpecialHeadersTest.java
test/jdk/java/net/httpclient/StreamingBody.java
test/jdk/java/net/httpclient/ThrowingPublishers.java
test/jdk/java/net/httpclient/ThrowingPushPromises.java
test/jdk/java/net/httpclient/ThrowingSubscribers.java
test/jdk/java/net/httpclient/UnauthorizedTest.java
test/jdk/java/net/httpclient/http2/BadHeadersTest.java
test/jdk/java/net/httpclient/http2/BasicTest.java
test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java
test/jdk/java/net/httpclient/http2/ErrorTest.java
test/jdk/java/net/httpclient/http2/server/Http2TestServer.java
test/jdk/lib/testlibrary/jdk/testlibrary/testkeys
--- a/test/jdk/java/net/httpclient/AsFileDownloadTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/AsFileDownloadTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -303,7 +303,7 @@
         http2TestServer.addHandler(new Http2FileDispoHandler(), "/http2/afdt");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2/afdt";
 
-        https2TestServer = new Http2TestServer("localhost", true, 0);
+        https2TestServer = new Http2TestServer("localhost", true, sslContext);
         https2TestServer.addHandler(new Http2FileDispoHandler(), "/https2/afdt");
         https2URI = "https://" + https2TestServer.serverAuthority() + "/https2/afdt";
 
--- a/test/jdk/java/net/httpclient/BasicRedirectTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/BasicRedirectTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -228,7 +228,7 @@
         http2TestServer = HttpTestServer.of(new Http2TestServer("localhost", false, 0));
         http2TestServer.addHandler(new BasicHttpRedirectHandler(), "/http2/same/");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2/same/redirect";
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(new BasicHttpRedirectHandler(), "/https2/same/");
         https2URI = "https://" + https2TestServer.serverAuthority() + "/https2/same/redirect";
 
--- a/test/jdk/java/net/httpclient/ConcurrentResponses.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/ConcurrentResponses.java	Tue Jun 19 09:13:58 2018 +0100
@@ -280,7 +280,7 @@
         http2TestServer.addHandler(new Http2VariableHandler(), "/http2/variable");
         http2VariableURI = "http://" + http2TestServer.serverAuthority() + "/http2/variable";
 
-        https2TestServer = new Http2TestServer("localhost", true, 0);
+        https2TestServer = new Http2TestServer("localhost", true, sslContext);
         https2TestServer.addHandler(new Http2FixedHandler(), "/https2/fixed");
         https2FixedURI = "https://" + https2TestServer.serverAuthority() + "/https2/fixed";
         https2TestServer.addHandler(new Http2VariableHandler(), "/https2/variable");
--- a/test/jdk/java/net/httpclient/CookieHeaderTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/CookieHeaderTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -205,7 +205,7 @@
         http2TestServer = HttpTestServer.of(new Http2TestServer("localhost", false, 0));
         http2TestServer.addHandler(new CookieValidationHandler(), "/http2/cookie/");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2/cookie/retry";
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(new CookieValidationHandler(), "/https2/cookie/");
         https2URI = "https://" + https2TestServer.serverAuthority() + "/https2/cookie/retry";
 
--- a/test/jdk/java/net/httpclient/CustomRequestPublisher.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/CustomRequestPublisher.java	Tue Jun 19 09:13:58 2018 +0100
@@ -340,7 +340,7 @@
         http2TestServer.addHandler(new Http2EchoHandler(), "/http2/echo");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2/echo";
 
-        https2TestServer = new Http2TestServer("localhost", true, 0);
+        https2TestServer = new Http2TestServer("localhost", true, sslContext);
         https2TestServer.addHandler(new Http2EchoHandler(), "/https2/echo");
         https2URI = "https://" + https2TestServer.serverAuthority() + "/https2/echo";
 
--- a/test/jdk/java/net/httpclient/CustomResponseSubscriber.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/CustomResponseSubscriber.java	Tue Jun 19 09:13:58 2018 +0100
@@ -217,7 +217,7 @@
         http2URI_fixed = "http://" + http2TestServer.serverAuthority() + "/http2/fixed";
         http2URI_chunk = "http://" + http2TestServer.serverAuthority() + "/http2/chunk";
 
-        https2TestServer = new Http2TestServer("localhost", true, 0);
+        https2TestServer = new Http2TestServer("localhost", true, sslContext);
         https2TestServer.addHandler(h2_fixedLengthHandler, "/https2/fixed");
         https2TestServer.addHandler(h2_chunkedHandler, "/https2/chunk");
         https2URI_fixed = "https://" + https2TestServer.serverAuthority() + "/https2/fixed";
--- a/test/jdk/java/net/httpclient/DependentActionsTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/DependentActionsTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -606,7 +606,7 @@
         http2URI_fixed = "http://" + http2TestServer.serverAuthority() + "/http2/fixed/x";
         http2URI_chunk = "http://" + http2TestServer.serverAuthority() + "/http2/chunk/x";
 
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(h2_fixedLengthHandler, "/https2/fixed");
         https2TestServer.addHandler(h2_chunkedHandler, "/https2/chunk");
         https2URI_fixed = "https://" + https2TestServer.serverAuthority() + "/https2/fixed/x";
--- a/test/jdk/java/net/httpclient/DependentPromiseActionsTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/DependentPromiseActionsTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -672,7 +672,7 @@
         http2URI_fixed = "http://" + http2TestServer.serverAuthority() + "/http2/fixed/y";
         http2URI_chunk = "http://" + http2TestServer.serverAuthority() + "/http2/chunk/y";
 
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(h2_fixedLengthHandler, "/https2/fixed");
         https2TestServer.addHandler(h2_chunkedHandler, "/https2/chunk");
         https2URI_fixed = "https://" + https2TestServer.serverAuthority() + "/https2/fixed/y";
--- a/test/jdk/java/net/httpclient/EncodedCharsInURI.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/EncodedCharsInURI.java	Tue Jun 19 09:13:58 2018 +0100
@@ -285,7 +285,7 @@
         http2URI_fixed = "http://" + http2TestServer.serverAuthority() + "/http2/fixed/x";
         http2URI_chunk = "http://" + http2TestServer.serverAuthority() + "/http2/chunk/x";
 
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(h2_fixedLengthHandler, "/https2/fixed");
         https2TestServer.addHandler(h2_chunkedHandler, "/https2/chunk");
         https2URI_fixed = "https://" + https2TestServer.serverAuthority() + "/https2/fixed/x";
--- a/test/jdk/java/net/httpclient/EscapedOctetsInURI.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/EscapedOctetsInURI.java	Tue Jun 19 09:13:58 2018 +0100
@@ -201,7 +201,7 @@
         http2TestServer.addHandler(new HttpASCIIUriStringHandler(), "/http2");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2";
 
-        https2TestServer = new Http2TestServer("localhost", true, 0);
+        https2TestServer = new Http2TestServer("localhost", true, sslContext);
         https2TestServer.addHandler(new HttpASCIIUriStringHandler(), "/https2");
         https2URI = "https://" + https2TestServer.serverAuthority() + "/https2";
 
--- a/test/jdk/java/net/httpclient/FlowAdapterPublisherTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/FlowAdapterPublisherTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -359,7 +359,7 @@
         http2TestServer.addHandler(new Http2EchoHandler(), "/http2/echo");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2/echo";
 
-        https2TestServer = new Http2TestServer("localhost", true, 0);
+        https2TestServer = new Http2TestServer("localhost", true, sslContext);
         https2TestServer.addHandler(new Http2EchoHandler(), "/https2/echo");
         https2URI = "https://" + https2TestServer.serverAuthority() + "/https2/echo";
 
--- a/test/jdk/java/net/httpclient/FlowAdapterSubscriberTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/FlowAdapterSubscriberTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -534,7 +534,7 @@
         http2TestServer.addHandler(new Http2EchoHandler(), "/http2/echo");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2/echo";
 
-        https2TestServer = new Http2TestServer("localhost", true, 0);
+        https2TestServer = new Http2TestServer("localhost", true, sslContext);
         https2TestServer.addHandler(new Http2EchoHandler(), "/https2/echo");
         https2URI = "https://" + https2TestServer.serverAuthority() + "/https2/echo";
 
--- a/test/jdk/java/net/httpclient/HandshakeFailureTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/HandshakeFailureTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -23,6 +23,7 @@
 
 import javax.net.ServerSocketFactory;
 import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLParameters;
 import javax.net.ssl.SSLHandshakeException;
 import javax.net.ssl.SSLSocket;
 import java.io.DataInputStream;
@@ -80,9 +81,17 @@
         }
     }
 
+    static HttpClient getClient() {
+        SSLParameters params = new SSLParameters();
+        params.setProtocols(new String[] {"TLSv1.2"});
+        return HttpClient.newBuilder()
+                .sslParameters(params)
+                .build();
+    }
+
     void testSyncSameClient(URI uri, Version version) throws Exception {
         out.printf("%n--- testSyncSameClient %s ---%n", version);
-        HttpClient client = HttpClient.newHttpClient();
+        HttpClient client = getClient();
         for (int i = 0; i < TIMES; i++) {
             out.printf("iteration %d%n", i);
             HttpRequest request = HttpRequest.newBuilder(uri)
@@ -104,7 +113,7 @@
         for (int i = 0; i < TIMES; i++) {
             out.printf("iteration %d%n", i);
             // a new client each time
-            HttpClient client = HttpClient.newHttpClient();
+            HttpClient client = getClient();
             HttpRequest request = HttpRequest.newBuilder(uri)
                                              .version(version)
                                              .build();
@@ -121,7 +130,7 @@
 
     void testAsyncSameClient(URI uri, Version version) throws Exception {
         out.printf("%n--- testAsyncSameClient %s ---%n", version);
-        HttpClient client = HttpClient.newHttpClient();
+        HttpClient client = getClient();
         for (int i = 0; i < TIMES; i++) {
             out.printf("iteration %d%n", i);
             HttpRequest request = HttpRequest.newBuilder(uri)
@@ -146,7 +155,7 @@
         for (int i = 0; i < TIMES; i++) {
             out.printf("iteration %d%n", i);
             // a new client each time
-            HttpClient client = HttpClient.newHttpClient();
+            HttpClient client = getClient();
             HttpRequest request = HttpRequest.newBuilder(uri)
                                              .version(version)
                                              .build();
--- a/test/jdk/java/net/httpclient/ImmutableFlowItems.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/ImmutableFlowItems.java	Tue Jun 19 09:13:58 2018 +0100
@@ -206,7 +206,7 @@
         http2URI_fixed = "http://" + http2TestServer.serverAuthority() + "/http2/fixed";
         http2URI_chunk = "http://" + http2TestServer.serverAuthority() + "/http2/chunk";
 
-        https2TestServer = new Http2TestServer("localhost", true, 0);
+        https2TestServer = new Http2TestServer("localhost", true, sslContext);
         https2TestServer.addHandler(h2_fixedLengthHandler, "/https2/fixed");
         https2TestServer.addHandler(h2_chunkedHandler, "/https2/chunk");
         https2URI_fixed = "https://" + https2TestServer.serverAuthority() + "/https2/fixed";
--- a/test/jdk/java/net/httpclient/InvalidInputStreamSubscriptionRequest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/InvalidInputStreamSubscriptionRequest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -472,7 +472,7 @@
         http2URI_fixed = "http://" + http2TestServer.serverAuthority() + "/http2/fixed";
         http2URI_chunk = "http://" + http2TestServer.serverAuthority() + "/http2/chunk";
 
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(h2_fixedLengthHandler, "/https2/fixed");
         https2TestServer.addHandler(h2_chunkedHandler, "/https2/chunk");
         https2URI_fixed = "https://" + https2TestServer.serverAuthority() + "/https2/fixed";
--- a/test/jdk/java/net/httpclient/InvalidSSLContextTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/InvalidSSLContextTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -173,7 +173,7 @@
                         s.startHandshake();
                         s.close();
                         Assert.fail("SERVER: UNEXPECTED ");
-                    } catch (SSLHandshakeException he) {
+                    } catch (SSLException he) {
                         System.out.println("SERVER: caught expected " + he);
                     } catch (IOException e) {
                         System.out.println("SERVER: caught: " + e);
--- a/test/jdk/java/net/httpclient/InvalidSubscriptionRequest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/InvalidSubscriptionRequest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -404,7 +404,7 @@
         http2URI_fixed = "http://" + http2TestServer.serverAuthority() + "/http2/fixed";
         http2URI_chunk = "http://" + http2TestServer.serverAuthority() + "/http2/chunk";
 
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(h2_fixedLengthHandler, "/https2/fixed");
         https2TestServer.addHandler(h2_chunkedHandler, "/https2/chunk");
         https2URI_fixed = "https://" + https2TestServer.serverAuthority() + "/https2/fixed";
--- a/test/jdk/java/net/httpclient/LineBodyHandlerTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/LineBodyHandlerTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -661,7 +661,7 @@
         http2TestServer.addHandler(new HttpTestEchoHandler(), "/http2/echo");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2/echo";
 
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(new HttpTestEchoHandler(), "/https2/echo");
         https2URI = "https://" + https2TestServer.serverAuthority() + "/https2/echo";
 
--- a/test/jdk/java/net/httpclient/MappingResponseSubscriber.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/MappingResponseSubscriber.java	Tue Jun 19 09:13:58 2018 +0100
@@ -224,7 +224,7 @@
         http2URI_fixed = "http://" + http2TestServer.serverAuthority() + "/http2/fixed";
         http2URI_chunk = "http://" + http2TestServer.serverAuthority() + "/http2/chunk";
 
-        https2TestServer = new Http2TestServer("localhost", true, 0);
+        https2TestServer = new Http2TestServer("localhost", true, sslContext);
         https2TestServer.addHandler(h2_fixedLengthHandler, "/https2/fixed");
         https2TestServer.addHandler(h2_chunkedHandler, "/https2/chunk");
         https2URI_fixed = "https://" + https2TestServer.serverAuthority() + "/https2/fixed";
--- a/test/jdk/java/net/httpclient/MaxStreams.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/MaxStreams.java	Tue Jun 19 09:13:58 2018 +0100
@@ -76,6 +76,7 @@
     Http2TestServer http2TestServer;   // HTTP/2 ( h2c )
     Http2TestServer https2TestServer;   // HTTP/2 ( h2 )
     final Http2FixedHandler handler = new Http2FixedHandler();
+    SSLContext ctx;
     String http2FixedURI;
     String https2FixedURI;
     volatile CountDownLatch latch;
@@ -107,7 +108,7 @@
         canStartTestRun.acquire();
         latch = new CountDownLatch(1);
         handler.setLatch(latch);
-        HttpClient client = HttpClient.newBuilder().build();
+        HttpClient client = HttpClient.newBuilder().sslContext(ctx).build();
         List<CompletableFuture<HttpResponse<String>>> responses = new LinkedList<>();
 
         HttpRequest request = HttpRequest.newBuilder(URI.create(uri))
@@ -169,7 +170,7 @@
 
     @BeforeTest
     public void setup() throws Exception {
-        SSLContext ctx = (new SimpleSSLContext()).get();
+        ctx = (new SimpleSSLContext()).get();
         exec = Executors.newCachedThreadPool();
 
         InetSocketAddress sa = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0);
--- a/test/jdk/java/net/httpclient/NonAsciiCharsInURI.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/NonAsciiCharsInURI.java	Tue Jun 19 09:13:58 2018 +0100
@@ -216,7 +216,7 @@
         http2TestServer.addHandler(handler, "/http2");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2";
 
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(handler, "/https2");
         https2URI = "https://" + https2TestServer.serverAuthority() + "/https2";
 
--- a/test/jdk/java/net/httpclient/RedirectMethodChange.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/RedirectMethodChange.java	Tue Jun 19 09:13:58 2018 +0100
@@ -212,7 +212,7 @@
         http2TestServer.addHandler(handler, "/http2/");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2/test/rmt";
 
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         targetURI = "https://" + https2TestServer.serverAuthority() + "/https2/redirect/rmt";
         handler = new RedirMethodChgeHandler(targetURI);
         https2TestServer.addHandler(handler, "/https2/");
--- a/test/jdk/java/net/httpclient/RedirectWithCookie.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/RedirectWithCookie.java	Tue Jun 19 09:13:58 2018 +0100
@@ -167,7 +167,7 @@
         http2TestServer = HttpTestServer.of(new Http2TestServer("localhost", false, 0));
         http2TestServer.addHandler(new CookieRedirectHandler(), "/http2/cookie/");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2/cookie/redirect";
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(new CookieRedirectHandler(), "/https2/cookie/");
         https2URI = "https://" + https2TestServer.serverAuthority() + "/https2/cookie/redirect";
 
--- a/test/jdk/java/net/httpclient/ResponsePublisher.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/ResponsePublisher.java	Tue Jun 19 09:13:58 2018 +0100
@@ -426,7 +426,7 @@
         http2URI_fixed = "http://" + http2TestServer.serverAuthority() + "/http2/fixed";
         http2URI_chunk = "http://" + http2TestServer.serverAuthority() + "/http2/chunk";
 
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(h2_fixedLengthHandler, "/https2/fixed");
         https2TestServer.addHandler(h2_chunkedHandler, "/https2/chunk");
         https2URI_fixed = "https://" + https2TestServer.serverAuthority() + "/https2/fixed";
--- a/test/jdk/java/net/httpclient/RetryWithCookie.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/RetryWithCookie.java	Tue Jun 19 09:13:58 2018 +0100
@@ -165,7 +165,7 @@
         http2TestServer = HttpTestServer.of(new Http2TestServer("localhost", false, 0));
         http2TestServer.addHandler(new CookieRetryHandler(), "/http2/cookie/");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2/cookie/retry";
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(new CookieRetryHandler(), "/https2/cookie/");
         https2URI = "https://" + https2TestServer.serverAuthority() + "/https2/cookie/retry";
 
--- a/test/jdk/java/net/httpclient/ShortResponseBody.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/ShortResponseBody.java	Tue Jun 19 09:13:58 2018 +0100
@@ -66,6 +66,7 @@
 import org.testng.annotations.Test;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLServerSocketFactory;
+import javax.net.ssl.SSLParameters;
 import javax.net.ssl.SSLSocket;
 import static java.lang.System.out;
 import static java.net.http.HttpClient.Builder.NO_PROXY;
@@ -91,6 +92,7 @@
     String httpURIFixLen;
 
     SSLContext sslContext;
+    SSLParameters sslParameters;
 
     static final String EXPECTED_RESPONSE_BODY =
             "<html><body><h1>Heading</h1><p>Some Text</p></body></html>";
@@ -117,11 +119,7 @@
 
     @Test(dataProvider = "sanity")
     void sanity(String url) throws Exception {
-        HttpClient client = HttpClient.newBuilder()
-                .proxy(NO_PROXY)
-                .sslContext(sslContext)
-                .executor(service)
-                .build();
+        HttpClient client = newHttpClient();
         HttpRequest request = HttpRequest.newBuilder(URI.create(url)).build();
         HttpResponse<String> response = client.send(request, ofString());
         String body = response.body();
@@ -208,6 +206,7 @@
         return HttpClient.newBuilder()
                 .proxy(NO_PROXY)
                 .sslContext(sslContext)
+                .sslParameters(sslParameters)
                 .executor(service)
                 .build();
     }
@@ -638,6 +637,9 @@
             throw new AssertionError("Unexpected null sslContext");
         SSLContext.setDefault(sslContext);
 
+        sslParameters = new SSLParameters();
+        sslParameters.setProtocols(new String[] {"TLSv1.2"});
+
         closeImmediatelyServer = new PlainCloseImmediatelyServer();
         httpURIClsImed = "http://" + serverAuthority(closeImmediatelyServer)
                 + "/http1/closeImmediately/foo";
--- a/test/jdk/java/net/httpclient/SpecialHeadersTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/SpecialHeadersTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -241,7 +241,7 @@
         http2TestServer.addHandler(handler, "/http2");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2";
 
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(handler, "/https2");
         https2URI = "https://" + https2TestServer.serverAuthority() + "/https2";
 
--- a/test/jdk/java/net/httpclient/StreamingBody.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/StreamingBody.java	Tue Jun 19 09:13:58 2018 +0100
@@ -136,7 +136,7 @@
         http2TestServer = HttpTestServer.of(new Http2TestServer("localhost", false, 0));
         http2TestServer.addHandler(new MessageHandler(), "/http2/streamingbody/");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2/streamingbody/y";
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(new MessageHandler(), "/https2/streamingbody/");
         https2URI = "https://" + https2TestServer.serverAuthority() + "/https2/streamingbody/z";
 
--- a/test/jdk/java/net/httpclient/ThrowingPublishers.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/ThrowingPublishers.java	Tue Jun 19 09:13:58 2018 +0100
@@ -621,7 +621,7 @@
         http2URI_fixed = "http://" + http2TestServer.serverAuthority() + "/http2/fixed/x";
         http2URI_chunk = "http://" + http2TestServer.serverAuthority() + "/http2/chunk/x";
 
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(h2_fixedLengthHandler, "/https2/fixed");
         https2TestServer.addHandler(h2_chunkedHandler, "/https2/chunk");
         https2URI_fixed = "https://" + https2TestServer.serverAuthority() + "/https2/fixed/x";
--- a/test/jdk/java/net/httpclient/ThrowingPushPromises.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/ThrowingPushPromises.java	Tue Jun 19 09:13:58 2018 +0100
@@ -649,7 +649,7 @@
         http2URI_fixed = "http://" + http2TestServer.serverAuthority() + "/http2/fixed/x";
         http2URI_chunk = "http://" + http2TestServer.serverAuthority() + "/http2/chunk/x";
 
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(h2_fixedLengthHandler, "/https2/fixed");
         https2TestServer.addHandler(h2_chunkedHandler, "/https2/chunk");
         https2URI_fixed = "https://" + https2TestServer.serverAuthority() + "/https2/fixed/x";
--- a/test/jdk/java/net/httpclient/ThrowingSubscribers.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribers.java	Tue Jun 19 09:13:58 2018 +0100
@@ -679,7 +679,7 @@
         http2URI_fixed = "http://" + http2TestServer.serverAuthority() + "/http2/fixed/x";
         http2URI_chunk = "http://" + http2TestServer.serverAuthority() + "/http2/chunk/x";
 
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(h2_fixedLengthHandler, "/https2/fixed");
         https2TestServer.addHandler(h2_chunkedHandler, "/https2/chunk");
         https2URI_fixed = "https://" + https2TestServer.serverAuthority() + "/https2/fixed/x";
--- a/test/jdk/java/net/httpclient/UnauthorizedTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/UnauthorizedTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -207,7 +207,7 @@
         http2TestServer = HttpTestServer.of(new Http2TestServer("localhost", false, 0));
         http2TestServer.addHandler(new UnauthorizedHandler(), "/http2/");
         http2URI = "http://" + http2TestServer.serverAuthority() + "/http2";
-        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, 0));
+        https2TestServer = HttpTestServer.of(new Http2TestServer("localhost", true, sslContext));
         https2TestServer.addHandler(new UnauthorizedHandler(), "/https2/");
         https2URI = "https://" + https2TestServer.serverAuthority() + "/https2";
 
--- a/test/jdk/java/net/httpclient/http2/BadHeadersTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/http2/BadHeadersTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -229,7 +229,7 @@
         int port = http2TestServer.getAddress().getPort();
         http2URI = "http://localhost:" + port + "/http2/echo";
 
-        https2TestServer = new Http2TestServer("localhost", true, 0);
+        https2TestServer = new Http2TestServer("localhost", true, sslContext);
         https2TestServer.addHandler(new Http2EchoHandler(), "/https2/echo");
         port = https2TestServer.getAddress().getPort();
         https2URI = "https://localhost:" + port + "/https2/echo";
--- a/test/jdk/java/net/httpclient/http2/BasicTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/http2/BasicTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -222,7 +222,7 @@
         httpsServer.addHandler((t -> {
             SSLSession s = t.getSSLSession();
             String prot = s.getProtocol();
-            if (prot.equals("TLSv1.2")) {
+            if (prot.equals("TLSv1.2") || prot.equals("TLSv1.3")) {
                 t.sendResponseHeaders(200, -1);
             } else {
                 System.err.printf("Protocols =%s\n", prot);
--- a/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -169,7 +169,7 @@
         int port = http2TestServer.getAddress().getPort();
         http2URI = "http://localhost:" + port + "/http2/echo";
 
-        https2TestServer = new Http2TestServer("localhost", true, 0);
+        https2TestServer = new Http2TestServer("localhost", true, sslContext);
         https2TestServer.addHandler(new Http2EchoHandler(), "/https2/echo");
         port = https2TestServer.getAddress().getPort();
         https2URI = "https://localhost:" + port + "/https2/echo";
--- a/test/jdk/java/net/httpclient/http2/ErrorTest.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/http2/ErrorTest.java	Tue Jun 19 09:13:58 2018 +0100
@@ -58,7 +58,7 @@
  */
 public class ErrorTest {
 
-    static final String[] CIPHER_SUITES = new String[]{ "TLS_KRB5_WITH_3DES_EDE_CBC_SHA" };
+    static final String[] CIPHER_SUITES = new String[]{ "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" };
 
     static final String SIMPLE_STRING = "Hello world Goodbye world";
 
--- a/test/jdk/java/net/httpclient/http2/server/Http2TestServer.java	Mon Jun 18 09:57:09 2018 +0100
+++ b/test/jdk/java/net/httpclient/http2/server/Http2TestServer.java	Tue Jun 19 09:13:58 2018 +0100
@@ -135,14 +135,18 @@
     {
         this.serverName = serverName;
         if (secure) {
+           if (context != null)
+               this.sslContext = context;
+           else
+               this.sslContext = SSLContext.getDefault();
             server = initSecure(port, backlog);
         } else {
+            this.sslContext = context;
             server = initPlaintext(port, backlog);
         }
         this.secure = secure;
         this.exec = exec == null ? getDefaultExecutor() : exec;
         this.handlers = Collections.synchronizedMap(new HashMap<>());
-        this.sslContext = context;
         this.properties = properties;
         this.connections = new HashMap<>();
     }
@@ -210,15 +214,12 @@
 
     final ServerSocket initSecure(int port, int backlog) throws Exception {
         ServerSocketFactory fac;
-        if (sslContext != null) {
-            fac = sslContext.getServerSocketFactory();
-        } else {
-            fac = SSLServerSocketFactory.getDefault();
-        }
+        SSLParameters sslp = null;
+        fac = sslContext.getServerSocketFactory();
+        sslp = sslContext.getSupportedSSLParameters();
         SSLServerSocket se = (SSLServerSocket) fac.createServerSocket();
         se.setReuseAddress(false);
         se.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), backlog);
-        SSLParameters sslp = se.getSSLParameters();
         sslp.setApplicationProtocols(new String[]{"h2"});
         sslp.setEndpointIdentificationAlgorithm("HTTPS");
         se.setSSLParameters(sslp);
Binary file test/jdk/lib/testlibrary/jdk/testlibrary/testkeys has changed