diff -r e5d0c20217a3 -r f4c9c5920141 test/jdk/java/net/httpclient/http2/server/Http2TestServerConnection.java --- a/test/jdk/java/net/httpclient/http2/server/Http2TestServerConnection.java Tue Feb 27 15:55:24 2018 +0000 +++ b/test/jdk/java/net/httpclient/http2/server/Http2TestServerConnection.java Tue Feb 27 16:08:08 2018 +0000 @@ -421,7 +421,7 @@ } HttpHeadersImpl decodeHeaders(List frames) throws IOException { - HttpHeadersImpl headers = new HttpHeadersImpl(); + HttpHeadersImpl headers = createNewResponseHeaders(); DecodingCallback cb = (name, value) -> { headers.addHeader(name.toString(), value.toString()); @@ -468,7 +468,7 @@ // First stream (1) comes from a plaintext HTTP/1.1 request @SuppressWarnings({"rawtypes","unchecked"}) void createPrimordialStream(Http1InitialRequest request) throws IOException { - HttpHeadersImpl headers = new HttpHeadersImpl(); + HttpHeadersImpl headers = createNewResponseHeaders(); String requestLine = getRequestLine(request.headers); String[] tokens = requestLine.split(" "); if (!tokens[2].equals("HTTP/1.1")) { @@ -572,7 +572,7 @@ String authority = headers.firstValue(":authority").orElse(""); //System.out.println("authority = " + authority); System.err.printf("TestServer: %s %s\n", method, path); - HttpHeadersImpl rspheaders = new HttpHeadersImpl(); + HttpHeadersImpl rspheaders = createNewResponseHeaders(); int winsize = clientSettings.getParameter( SettingsFrame.INITIAL_WINDOW_SIZE); //System.err.println ("Stream window size = " + winsize); @@ -609,6 +609,10 @@ } } + protected HttpHeadersImpl createNewResponseHeaders() { + return new HttpHeadersImpl(); + } + private SSLSession getSSLSession() { if (! (socket instanceof SSLSocket)) return null; @@ -797,7 +801,7 @@ // returns a minimal response with status 200 // that is the response to the push promise just sent private ResponseHeaders getPushResponse(int streamid) { - HttpHeadersImpl h = new HttpHeadersImpl(); + HttpHeadersImpl h = createNewResponseHeaders(); h.addHeader(":status", "200"); ResponseHeaders oh = new ResponseHeaders(h); oh.streamid(streamid);