Skip to content

Commit 2b8895f

Browse files
committed
Fix flaky testHttpsProxy_Http2Origin_tunnelled
1 parent 76715a4 commit 2b8895f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

vertx-core/src/test/java/io/vertx/tests/http/HttpsProxyTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
package io.vertx.tests.http;
1212

1313
import io.vertx.core.buffer.Buffer;
14+
1415
import io.vertx.core.http.HttpClientOptions;
1516
import io.vertx.core.http.HttpClientResponse;
1617
import io.vertx.core.http.HttpMethod;
@@ -135,15 +136,14 @@ public void testHttpsProxy_Http2Origin_tunnelled() throws Exception {
135136
.setTrustOptions(Trust.SERVER_JKS.get())
136137
.setProxyOptions(httpsProxy(proxy.port())));
137138

138-
HttpClientResponse resp = client.request(new RequestOptions().setMethod(HttpMethod.GET)
139+
String result = client.request(new RequestOptions().setMethod(HttpMethod.GET)
139140
.setHost(DEFAULT_HTTPS_HOST).setPort(DEFAULT_HTTPS_PORT).setURI("/"))
140141
.compose(req -> req.send().expecting(HttpResponseExpectation.SC_OK))
142+
.compose(resp -> resp.body().map(body -> resp.version() + ":" + body))
141143
.await();
142-
Buffer body = resp.body().await();
143144

144-
assertEquals("Hello from origin", body.toString());
145-
assertEquals(HttpVersion.HTTP_2, resp.version());
146145
// h2 rides the CONNECT tunnel for free; ALPN negotiates h2 end-to-end with the origin.
146+
assertEquals(HttpVersion.HTTP_2 + ":Hello from origin", result);
147147
assertEquals(HttpMethod.CONNECT, proxy.getLastMethod());
148148
}
149149

0 commit comments

Comments
 (0)