Skip to content

Commit

Permalink
Merge #3196 into 2.0.0-M4
Browse files Browse the repository at this point in the history
  • Loading branch information
violetagg committed Apr 24, 2024
2 parents 22b0c0e + 4d0f7ba commit 5e0e06f
Show file tree
Hide file tree
Showing 17 changed files with 96 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2023 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2011-2024 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1116,6 +1116,7 @@ void testDisposeTimeoutLongOverflow() {
}

@Test
@SuppressWarnings("deprecation")
void testSniSupport() throws Exception {
SelfSignedCertificate defaultCert = new SelfSignedCertificate("default");
TcpSslContextSpec defaultTcpSslContextSpec =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2020-2024 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -98,6 +98,7 @@ void testHttpNoSslH2Fails() {
}

@Test
@SuppressWarnings("deprecation")
void testHttpSslH2CFails() {
Http2SslContextSpec serverOptions = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());

Expand Down Expand Up @@ -225,6 +226,7 @@ void doTestMaxActiveStreams(HttpClient baseClient, int maxActiveStreams, int exp
doTestMaxActiveStreams(baseClient, maxActiveStreams, 256, 32, expectedOnNext, expectedOnError);
}

@SuppressWarnings("deprecation")
void doTestMaxActiveStreams(HttpClient baseClient, int maxActiveStreams, int concurrency, int prefetch, int expectedOnNext, int expectedOnError) throws Exception {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx =
Expand Down Expand Up @@ -287,6 +289,7 @@ else if (signal.getThrowable() instanceof PoolAcquireTimeoutException &&
}

@Test
@SuppressWarnings("deprecation")
void testHttp2ForMemoryLeaks() {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx =
Expand Down Expand Up @@ -375,6 +378,7 @@ void testMonoRequestBodySentAsFullRequest_Mono() {
doTestMonoRequestBodySentAsFullRequest(BufferMono.fromString(Mono.just("test")), 1);
}

@SuppressWarnings("deprecation")
private void doTestMonoRequestBodySentAsFullRequest(Publisher<? extends Buffer> body, int expectedMsg) {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx =
Expand Down Expand Up @@ -440,6 +444,7 @@ void testIssue1394_SchemeHttpConfiguredHTTP11AndH2NegotiatedHTTP11() {
doTestIssue1394_SchemeHttp("null", HttpProtocol.HTTP11, HttpProtocol.H2);
}

@SuppressWarnings("deprecation")
private void doTestIssue1394_SchemeHttp(String expectedStreamId, HttpProtocol... protocols) {
disposableServer =
createServer()
Expand Down Expand Up @@ -556,6 +561,7 @@ void testTooManyPermitsReturned_CustomPool() {
}
}

@SuppressWarnings("deprecation")
private void testTooManyPermitsReturned(HttpClient client) {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx =
Expand Down Expand Up @@ -621,6 +627,7 @@ void testPR2659_SchemeHttpsConfiguredWithSsl() {
doTestPR2659_SchemeHttps(s -> !"null".equals(s.toString()));
}

@SuppressWarnings("deprecation")
private static void doTestPR2659_SchemeHttps(Predicate<CharSequence> predicate) {
HttpClient.create()
.protocol(HttpProtocol.HTTP11, HttpProtocol.H2, HttpProtocol.H2C)
Expand Down Expand Up @@ -650,6 +657,7 @@ void testMaxStreamsH2C(HttpProtocol[] serverProtocols, HttpProtocol[] clientProt

@ParameterizedTest
@MethodSource("h2CompatibleCombinations")
@SuppressWarnings("deprecation")
void testMaxStreamsH2(HttpProtocol[] serverProtocols, HttpProtocol[] clientProtocols) {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx =
Expand Down Expand Up @@ -707,6 +715,7 @@ void testEmptyDataFrameH2C(HttpProtocol[] serverProtocols, HttpProtocol[] client

@ParameterizedTest
@MethodSource("h2CompatibleCombinations")
@SuppressWarnings("deprecation")
void testEmptyDataFrameH2(HttpProtocol[] serverProtocols, HttpProtocol[] clientProtocols) {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class HttpCompressionClientServerTests extends BaseHttpTest {
@interface ParameterizedCompressionTest {
}

@SuppressWarnings("deprecation")
static Object[][] data() throws Exception {
SelfSignedCertificate cert = new SelfSignedCertificate();
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(cert.certificate(), cert.privateKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,7 @@ void testServerConnectionsRecorderConnectionClose(HttpProtocol[] serverProtocols
}

@Test
@SuppressWarnings("deprecation")
void testIssue896() throws Exception {
disposableServer = httpServer.noSSL()
.bindNow();
Expand Down Expand Up @@ -946,6 +947,7 @@ void testServerConnectionsRecorderBadUriForwarded(HttpProtocol[] serverProtocols

@ParameterizedTest
@MethodSource("combinationsIssue2956")
@SuppressWarnings("deprecation")
void testIssue2956(boolean isCustomRecorder, boolean isHttp2) throws Exception {
HttpServer server =
httpServer.secure(spec -> spec.sslContext(isHttp2 ? serverCtx2 : serverCtx11))
Expand Down Expand Up @@ -1277,10 +1279,12 @@ private void checkExpectationsBadRequest(String serverAddress, boolean checkTls)
assertCounter(registry, CLIENT_ERRORS, summaryTags2).isNull();
}

@SuppressWarnings("deprecation")
HttpServer customizeServerOptions(HttpServer httpServer, @Nullable ProtocolSslContextSpec ctx, HttpProtocol[] protocols) {
return ctx == null ? httpServer.protocol(protocols) : httpServer.protocol(protocols).secure(spec -> spec.sslContext(ctx));
}

@SuppressWarnings("deprecation")
HttpClient customizeClientOptions(HttpClient httpClient, @Nullable ProtocolSslContextSpec ctx, HttpProtocol[] protocols) {
return ctx == null ? httpClient.protocol(protocols) : httpClient.protocol(protocols).secure(spec -> spec.sslContext(ctx));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2020-2024 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -180,6 +180,7 @@ static Object[][] dataCompatibleCombinations_CustomPool() throws Exception {
return data(true, false, true);
}

@SuppressWarnings("deprecation")
static Object[][] data(boolean onlyCompatible, boolean disablePool, boolean useCustomPool) throws Exception {
SelfSignedCertificate cert = new SelfSignedCertificate();
Http11SslContextSpec serverCtxHttp11 = Http11SslContextSpec.forServer(cert.certificate(), cert.privateKey());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2023 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2017-2024 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -71,6 +71,7 @@ void httpStatusCode404IsHandledByTheClient() {

@ParameterizedTest
@MethodSource("httpCompatibleCombinations")
@SuppressWarnings("deprecation")
void noContentStatusCodes(HttpProtocol[] serverProtocols, HttpProtocol[] clientProtocols) throws Exception {
SelfSignedCertificate ssc = new SelfSignedCertificate();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2023 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2021-2024 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -75,6 +75,7 @@ class ConnectionPoolTests extends BaseHttpTest {
HttpClient client;

@BeforeAll
@SuppressWarnings("deprecation")
static void prepare() throws CertificateException {
HttpServer server = createServer();

Expand Down Expand Up @@ -359,6 +360,7 @@ void testClientWithDecoder() {
}

@Test
@SuppressWarnings("deprecation")
void testClientWithProtocols() {
Http11SslContextSpec http11SslContextSpec =
Http11SslContextSpec.forClient()
Expand All @@ -381,6 +383,7 @@ void testClientWithProtocols() {
}

@Test
@SuppressWarnings("deprecation")
void testClientWithSecurity_1() {
Http11SslContextSpec http11SslContextSpec1 =
Http11SslContextSpec.forClient()
Expand All @@ -402,6 +405,7 @@ void testClientWithSecurity_1() {
}

@Test
@SuppressWarnings("deprecation")
void testClientWithSecurity_2() {
HttpClient localClient1 =
client.port(server4.port())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ void shouldNotResolveTargetHostnameWhenMetricsDisabled(Hoverfly hoverfly) {
}

@Test
@SuppressWarnings("deprecation")
void shouldUseDifferentResolvers(Hoverfly hoverfly) {
Http11SslContextSpec http11SslContextSpec =
Http11SslContextSpec.forClient()
Expand Down Expand Up @@ -278,6 +279,7 @@ private Mono<Tuple2<String, HttpHeaders>> sendRequest(
return sendRequest(proxyOptions, connectAddressSupplier, uri, wiretap, false, false);
}

@SuppressWarnings("deprecation")
private Mono<Tuple2<String, HttpHeaders>> sendRequest(
Consumer<? super ProxyProvider.TypeSpec> proxyOptions,
@Nullable Supplier<? extends SocketAddress> connectAddressSupplier,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2023 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2011-2024 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -915,6 +915,7 @@ void testIssue361() {
}

@Test
@SuppressWarnings("deprecation")
void testIssue473() {
Http11SslContextSpec serverSslContextBuilder =
Http11SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Expand All @@ -934,6 +935,7 @@ void testIssue473() {
}

@Test
@SuppressWarnings("deprecation")
void testIssue407_1() {
disposableServer =
createServer()
Expand Down Expand Up @@ -995,6 +997,7 @@ void testIssue407_1() {
}

@Test
@SuppressWarnings("deprecation")
void testIssue407_2() {
disposableServer =
createServer()
Expand Down Expand Up @@ -1822,6 +1825,7 @@ void testIssue719_CLNoTextWithSSL() {
h -> h.set("Content-Length", "0"), true);
}

@SuppressWarnings("deprecation")
private void doTestIssue719(Publisher<Buffer> clientSend,
Consumer<HttpHeaders> clientSendHeaders, boolean ssl) {
HttpServer server =
Expand Down Expand Up @@ -2047,6 +2051,7 @@ void testConnectionLifeTimeFixedPoolHttp1() throws Exception {
}

@Test
@SuppressWarnings("deprecation")
void testConnectionLifeTimeFixedPoolHttp2_1() throws Exception {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx =
Expand Down Expand Up @@ -2089,6 +2094,7 @@ void testConnectionLifeTimeElasticPoolHttp1() throws Exception {
}

@Test
@SuppressWarnings("deprecation")
void testConnectionLifeTimeElasticPoolHttp2() throws Exception {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx =
Expand Down Expand Up @@ -2130,6 +2136,7 @@ void testConnectionNoLifeTimeFixedPoolHttp1() throws Exception {
}

@Test
@SuppressWarnings("deprecation")
void testConnectionNoLifeTimeFixedPoolHttp2() throws Exception {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx =
Expand Down Expand Up @@ -2168,6 +2175,7 @@ void testConnectionNoLifeTimeElasticPoolHttp1() throws Exception {
}

@Test
@SuppressWarnings("deprecation")
void testConnectionNoLifeTimeElasticPoolHttp2() throws Exception {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx =
Expand Down Expand Up @@ -2214,6 +2222,7 @@ private ChannelId[] doTestConnectionLifeTime(HttpServer server, HttpClient clien
}

@Test
@SuppressWarnings("deprecation")
void testConnectionLifeTimeFixedPoolHttp2_2() {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ void testFollowRedirectPredicateThrowsException() {
}

@Test
@SuppressWarnings("deprecation")
void testIssue843() {
final int server2Port = SocketUtils.findAvailableTcpPort();

Expand Down Expand Up @@ -472,6 +473,7 @@ void testIssue843() {
}

@Test
@SuppressWarnings("deprecation")
void testHttpRequestIfRedirectHttpToHttpsEnabled() {
Http11SslContextSpec sslContext = Http11SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
disposableServer =
Expand Down Expand Up @@ -502,6 +504,7 @@ void testHttpRequestIfRedirectHttpToHttpsEnabled() {
}

@Test
@SuppressWarnings("deprecation")
void testHttpsRequestIfRedirectHttpToHttpsEnabled() {
String message = "The client should receive the message";
disposableServer =
Expand Down Expand Up @@ -529,6 +532,7 @@ void testHttpsRequestIfRedirectHttpToHttpsEnabled() {
}

@Test
@SuppressWarnings("deprecation")
void testRelativeRedirectKeepsScheme() {
final String requestPath = "/request";
final String redirectPath = "/redirect";
Expand Down Expand Up @@ -562,6 +566,7 @@ void testRelativeRedirectKeepsScheme() {
}

@Test
@SuppressWarnings("deprecation")
void testLastLocationSetToResourceUrlOnRedirect() {
final String redirectPath = "/redirect";
final String destinationPath = "/destination";
Expand Down Expand Up @@ -674,6 +679,7 @@ void testHttpServerWithDomainSockets_HTTP11() {
}

@Test
@SuppressWarnings("deprecation")
void testHttpServerWithDomainSockets_HTTP2() {
Http11SslContextSpec serverCtx = Http11SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http11SslContextSpec clientCtx =
Expand Down Expand Up @@ -708,6 +714,7 @@ private void doTestHttpServerWithDomainSockets(HttpServer server, HttpClient cli
}

@Test
@SuppressWarnings("deprecation")
void testHttp2Redirect() {
Http2SslContextSpec serverCtx = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Http2SslContextSpec clientCtx =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,7 @@ private void doTestConnectionClosedWhenFailedUpgrade(

@ParameterizedTest
@MethodSource("http11CompatibleProtocols")
@SuppressWarnings("deprecation")
public void testIssue3036(HttpProtocol[] serverProtocols, HttpProtocol[] clientProtocols,
@Nullable SslProvider.ProtocolSslContextSpec serverCtx, @Nullable SslProvider.ProtocolSslContextSpec clientCtx) {
WebsocketServerSpec websocketServerSpec = WebsocketServerSpec.builder().compress(true).build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2022-2024 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -108,6 +108,7 @@ public BiConsumer<BuildingBlocks, Deque<ObservationHandler<? extends Observation
}

@Override
@SuppressWarnings("deprecation")
public SampleTestRunnerConsumer yourCode() {
return (bb, meterRegistry) -> {
Http2SslContextSpec serverCtxHttp = Http2SslContextSpec.forServer(ssc.certificate(), ssc.privateKey());
Expand Down Expand Up @@ -181,6 +182,7 @@ public SampleTestRunnerConsumer yourCode() {
};
}

@SuppressWarnings("deprecation")
static void sendHttp2Request(HttpClient client) throws Exception {
Http2SslContextSpec clientCtxHttp2 =
Http2SslContextSpec.forClient()
Expand All @@ -189,6 +191,7 @@ static void sendHttp2Request(HttpClient client) throws Exception {
sendRequest(client.secure(spec -> spec.sslContext(clientCtxHttp2)).protocol(HttpProtocol.H2));
}

@SuppressWarnings("deprecation")
static void sendHttp11Request(HttpClient client) throws Exception {
Http11SslContextSpec clientCtxHttp11 =
Http11SslContextSpec.forClient()
Expand Down
Loading

0 comments on commit 5e0e06f

Please sign in to comment.