2727 * @summary checks connection flow control
2828 * @library /test/lib /test/jdk/java/net/httpclient/lib
2929 * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext
30- * @run junit/othervm -Djdk.internal.httpclient.debug=true
30+ * @run junit/othervm -Djdk.internal.httpclient.debug=err
3131 * -Djdk.httpclient.connectionWindowSize=65535
3232 * -Djdk.httpclient.windowsize=16384
3333 * ConnectionFlowControlTest
@@ -122,7 +122,7 @@ void test(String uri) throws Exception {
122122 final HttpClient cc = client ;
123123 var response = cc .send (request , BodyHandlers .ofInputStream ());
124124 responses .put (query , response );
125- String ckey = response .headers (). firstValue ( "X-Connection-Key" ).get ();
125+ String ckey = response .connectionLabel ( ).get ();
126126 if (label == null ) label = ckey ;
127127 try {
128128 if (i < max - 1 ) {
@@ -149,7 +149,7 @@ void test(String uri) throws Exception {
149149 try {
150150 String query = keys [i ];
151151 var response = responses .get (keys [i ]);
152- String ckey = response .headers (). firstValue ( "X-Connection-Key" ).get ();
152+ String ckey = response .connectionLabel ( ).get ();
153153 if (label == null ) label = ckey ;
154154 if (i < max - 1 ) {
155155 // the connection window might be exceeded at i == max - 2, which
@@ -206,7 +206,7 @@ void test(String uri) throws Exception {
206206 System .out .println ("\n Sending last request:" + uriWithQuery );
207207 var response = client .send (request , BodyHandlers .ofString ());
208208 if (label != null ) {
209- String ckey = response .headers (). firstValue ( "X-Connection-Key" ).get ();
209+ String ckey = response .connectionLabel ( ).get ();
210210 assertNotEquals (label , ckey );
211211 System .out .printf ("last request %s sent on different connection as expected:" +
212212 "\n \t last: %s\n \t previous: %s%n" , query , ckey , label );
@@ -281,7 +281,6 @@ public void handle(Http2TestExchange t) throws IOException {
281281 byte [] bytes = is .readAllBytes ();
282282 System .out .println ("Server " + t .getLocalAddress () + " received:\n "
283283 + t .getRequestURI () + ": " + new String (bytes , StandardCharsets .UTF_8 ));
284- t .getResponseHeaders ().setHeader ("X-Connection-Key" , t .getConnectionKey ());
285284
286285 if (bytes .length == 0 ) bytes = "no request body!" .getBytes (StandardCharsets .UTF_8 );
287286 int window = Math .max (16384 , Integer .getInteger ("jdk.httpclient.windowsize" , 2 *16 *1024 ));
0 commit comments