diff -r 818a23db260c -r 4254bed3c09d test/jdk/java/net/httpclient/DependentPromiseActionsTest.java --- a/test/jdk/java/net/httpclient/DependentPromiseActionsTest.java Wed Jun 20 17:15:16 2018 +0200 +++ b/test/jdk/java/net/httpclient/DependentPromiseActionsTest.java Wed Jun 20 09:05:57 2018 -0700 @@ -27,7 +27,7 @@ * completes are executed either asynchronously in an executor when the * CF later completes, or in the user thread that joins. * @library /lib/testlibrary http2/server - * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters ThrowingPublishers + * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters DependentPromiseActionsTest * @modules java.base/sun.net.www.http * java.net.http/jdk.internal.net.http.common * java.net.http/jdk.internal.net.http.frame @@ -40,7 +40,6 @@ import java.io.BufferedReader; import java.io.InputStreamReader; import java.lang.StackWalker.StackFrame; -import jdk.internal.net.http.common.HttpHeadersImpl; import jdk.testlibrary.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.AfterClass; @@ -79,6 +78,7 @@ import java.util.concurrent.Semaphore; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import java.util.function.BiPredicate; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; @@ -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"; @@ -690,8 +690,13 @@ https2TestServer.stop(); } - private static void pushPromiseFor(HttpTestExchange t, URI requestURI, String pushPath, boolean fixed) - throws IOException + static final BiPredicate ACCEPT_ALL = (x, y) -> true; + + private static void pushPromiseFor(HttpTestExchange t, + URI requestURI, + String pushPath, + boolean fixed) + throws IOException { try { URI promise = new URI(requestURI.getScheme(), @@ -700,9 +705,13 @@ byte[] promiseBytes = promise.toASCIIString().getBytes(UTF_8); out.printf("TestServer: %s Pushing promise: %s%n", now(), promise); err.printf("TestServer: %s Pushing promise: %s%n", now(), promise); - HttpTestHeaders headers = HttpTestHeaders.of(new HttpHeadersImpl()); + HttpHeaders headers; if (fixed) { - headers.addHeader("Content-length", String.valueOf(promiseBytes.length)); + String length = String.valueOf(promiseBytes.length); + headers = HttpHeaders.of(Map.of("Content-Length", List.of(length)), + ACCEPT_ALL); + } else { + headers = HttpHeaders.of(Map.of(), ACCEPT_ALL); // empty } t.serverPush(promise, headers, promiseBytes); } catch (URISyntaxException x) {