Skip to content

Commit

Permalink
http-netty: Fix flaky SslAndNonSslConnectionsTest (#2755)
Browse files Browse the repository at this point in the history
Motivation

We have a flaky test. It appears to be a rare case of netty
sending an IOException down the `exceptionCaught` netty
pipeline pathway that isn't handled.

Modifications

- Widen what we expect in the test to IOException
  • Loading branch information
bryce-anderson authored Nov 14, 2023
1 parent 8f7c2ea commit 370a81a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
import org.junit.jupiter.api.Test;
import org.mockito.stubbing.Answer;

import java.io.IOException;
import java.net.InetAddress;
import java.nio.channels.ClosedChannelException;
import java.security.cert.CertificateException;
import javax.annotation.Nullable;
import javax.net.ssl.SSLHandshakeException;
Expand Down Expand Up @@ -137,7 +137,7 @@ void nonSecureClientToSecureServerClosesConnection() throws Exception {
assert secureServerCtx != null;
try (BlockingHttpClient client = HttpClients.forSingleAddress(serverHostAndPort(secureServerCtx))
.buildBlocking()) {
assertThrows(ClosedChannelException.class, () -> client.request(client.get("/")));
assertThrows(IOException.class, () -> client.request(client.get("/")));
}
}

Expand All @@ -148,7 +148,7 @@ void secureClientToNonSecureServerClosesConnection() throws Exception {
.sslConfig(new ClientSslConfigBuilder(DefaultTestCerts::loadServerCAPem)
.peerHost(serverPemHostname()).build())
.buildBlocking()) {
assertThrows(ClosedChannelException.class, () -> client.request(client.get("/")));
assertThrows(IOException.class, () -> client.request(client.get("/")));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.nio.channels.ClosedChannelException;

/**
* {@link ClosedChannelException} that will not not fill in the stacktrace but use a cheaper way of producing
* {@link ClosedChannelException} that will not fill in the stacktrace but use a cheaper way of producing
* limited stacktrace details for the user.
*/
public final class StacklessClosedChannelException extends ClosedChannelException {
Expand Down

0 comments on commit 370a81a

Please sign in to comment.