Skip to content

Commit 168475e

Browse files
committed
Merge #2668 into 1.1.3
2 parents 981d2ae + 8b454bb commit 168475e

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

reactor-netty-http/src/test/java/reactor/netty/http/HttpMetricsHandlerTests.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ void testExistingEndpoint(HttpProtocol[] serverProtocols, HttpProtocol[] clientP
260260
int[] numWrites = new int[]{14, 25};
261261
int[] bytesWrite = new int[]{160, 243};
262262
int connIndex = 1;
263-
if (clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11) {
263+
if ((serverProtocols.length == 1 && serverProtocols[0] == HttpProtocol.HTTP11) ||
264+
(clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11)) {
264265
numWrites = new int[]{14, 28};
265266
bytesWrite = new int[]{151, 310};
266267
connIndex = 2;
@@ -391,7 +392,8 @@ void testNonExistingEndpoint(HttpProtocol[] serverProtocols, HttpProtocol[] clie
391392
int[] bytesWrite = new int[]{106, 122};
392393
int[] bytesRead = new int[]{37, 48};
393394
int connIndex = 1;
394-
if (clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11) {
395+
if ((serverProtocols.length == 1 && serverProtocols[0] == HttpProtocol.HTTP11) ||
396+
(clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11)) {
395397
numWrites = new int[]{1, 2};
396398
bytesWrite = new int[]{123, 246};
397399
bytesRead = new int[]{64, 128};
@@ -469,7 +471,8 @@ void testUriTagValueFunction(HttpProtocol[] serverProtocols, HttpProtocol[] clie
469471

470472
int numWrites = 14;
471473
int bytesWrite = 160;
472-
if (clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11) {
474+
if ((serverProtocols.length == 1 && serverProtocols[0] == HttpProtocol.HTTP11) ||
475+
(clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11)) {
473476
bytesWrite = 151;
474477
}
475478
else if (clientProtocols.length == 2 &&
@@ -532,7 +535,8 @@ void testUriTagValueFunctionNotSharedForClient(HttpProtocol[] serverProtocols, H
532535

533536
int[] numWrites = new int[]{14, 28};
534537
int[] bytesWrite = new int[]{160, 320};
535-
if (clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11) {
538+
if ((serverProtocols.length == 1 && serverProtocols[0] == HttpProtocol.HTTP11) ||
539+
(clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11)) {
536540
bytesWrite = new int[]{151, 302};
537541
}
538542
else if (clientProtocols.length == 2 &&
@@ -629,7 +633,8 @@ void testContextAwareRecorderOnServer(HttpProtocol[] serverProtocols, HttpProtoc
629633
void testServerConnectionsMicrometer(HttpProtocol[] serverProtocols, HttpProtocol[] clientProtocols,
630634
@Nullable ProtocolSslContextSpec serverCtx, @Nullable ProtocolSslContextSpec clientCtx) throws Exception {
631635
CountDownLatch responseSent = new CountDownLatch(1); // response fully sent by the server
632-
boolean isHttp11 = clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11;
636+
boolean isHttp11 = (serverProtocols.length == 1 && serverProtocols[0] == HttpProtocol.HTTP11) ||
637+
(clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11);
633638
HttpServer server = customizeServerOptions(httpServer, serverCtx, serverProtocols)
634639
.metrics(true, Function.identity())
635640
.doOnConnection(cnx -> {
@@ -685,7 +690,8 @@ void testServerConnectionsMicrometer(HttpProtocol[] serverProtocols, HttpProtoco
685690
@MethodSource("httpCompatibleProtocols")
686691
void testServerConnectionsMicrometerConnectionClose(HttpProtocol[] serverProtocols, HttpProtocol[] clientProtocols,
687692
@Nullable ProtocolSslContextSpec serverCtx, @Nullable ProtocolSslContextSpec clientCtx) throws Exception {
688-
boolean isHttp11 = clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11;
693+
boolean isHttp11 = (serverProtocols.length == 1 && serverProtocols[0] == HttpProtocol.HTTP11) ||
694+
(clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11);
689695

690696
disposableServer = customizeServerOptions(httpServer, serverCtx, serverProtocols)
691697
.metrics(true, Function.identity())
@@ -730,7 +736,8 @@ void testServerConnectionsRecorder(HttpProtocol[] serverProtocols, HttpProtocol[
730736
// Invoke ServerRecorder.INSTANCE.reset() here as disposableServer.dispose (AfterEach) might be invoked after
731737
// ServerRecorder.INSTANCE.reset() (AfterEach) and thus leave ServerRecorder.INSTANCE in a bad state
732738
ServerRecorder.INSTANCE.reset();
733-
boolean isHttp11 = clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11;
739+
boolean isHttp11 = (serverProtocols.length == 1 && serverProtocols[0] == HttpProtocol.HTTP11) ||
740+
(clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11);
734741

735742
disposableServer = customizeServerOptions(httpServer, serverCtx, serverProtocols)
736743
.doOnConnection(cnx -> ServerCloseHandler.INSTANCE.register(cnx.channel()))
@@ -776,7 +783,8 @@ void testServerConnectionsRecorderConnectionClose(HttpProtocol[] serverProtocols
776783
// Invoke ServerRecorder.INSTANCE.reset() here as disposableServer.dispose (AfterEach) might be invoked after
777784
// ServerRecorder.INSTANCE.reset() (AfterEach) and thus leave ServerRecorder.INSTANCE in a bad state
778785
ServerRecorder.INSTANCE.reset();
779-
boolean isHttp11 = clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11;
786+
boolean isHttp11 = (serverProtocols.length == 1 && serverProtocols[0] == HttpProtocol.HTTP11) ||
787+
(clientProtocols.length == 1 && clientProtocols[0] == HttpProtocol.HTTP11);
780788

781789
disposableServer = customizeServerOptions(httpServer, serverCtx, serverProtocols)
782790
.metrics(true, ServerRecorder.supplier(), Function.identity())
@@ -1075,8 +1083,11 @@ static Stream<Arguments> http11CompatibleProtocols() {
10751083
static Stream<Arguments> httpCompatibleProtocols() {
10761084
return Stream.of(
10771085
Arguments.of(new HttpProtocol[]{HttpProtocol.HTTP11}, new HttpProtocol[]{HttpProtocol.HTTP11}, null, null),
1086+
Arguments.of(new HttpProtocol[]{HttpProtocol.HTTP11}, new HttpProtocol[]{HttpProtocol.H2C, HttpProtocol.HTTP11}, null, null),
10781087
Arguments.of(new HttpProtocol[]{HttpProtocol.HTTP11}, new HttpProtocol[]{HttpProtocol.HTTP11},
10791088
Named.of("Http11SslContextSpec", serverCtx11), Named.of("Http11SslContextSpec", clientCtx11)),
1089+
Arguments.of(new HttpProtocol[]{HttpProtocol.HTTP11}, new HttpProtocol[]{HttpProtocol.H2, HttpProtocol.HTTP11},
1090+
Named.of("Http11SslContextSpec", serverCtx11), Named.of("Http11SslContextSpec", clientCtx11)),
10801091
Arguments.of(new HttpProtocol[]{HttpProtocol.H2}, new HttpProtocol[]{HttpProtocol.H2},
10811092
Named.of("Http2SslContextSpec", serverCtx2), Named.of("Http2SslContextSpec", clientCtx2)),
10821093
Arguments.of(new HttpProtocol[]{HttpProtocol.H2}, new HttpProtocol[]{HttpProtocol.H2, HttpProtocol.HTTP11},

0 commit comments

Comments
 (0)