diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-03-03 16:19:53 +0100 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-03-03 16:19:53 +0100 |
commit | 1f1c31c29613056f6a43137fd616c501a6c33084 (patch) | |
tree | eba06989de072e8c3d538d6251c514edb9860461 /jdisc_http_service/src | |
parent | 8a1dbed65e4794ca7c25c481c61c13505eeaa7de (diff) |
Add workaround for odd behaviour with Jetty or Apache httpclient
Diffstat (limited to 'jdisc_http_service/src')
-rw-r--r-- | jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java b/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java index 3b926225b19..7ecf1b00fc1 100644 --- a/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java +++ b/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java @@ -38,6 +38,7 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLException; import javax.net.ssl.SSLHandshakeException; import javax.security.auth.x500.X500Principal; import java.io.IOException; @@ -59,6 +60,8 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; import java.util.concurrent.TimeUnit; +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.regex.Pattern; import static com.yahoo.jdisc.Response.Status.GATEWAY_TIMEOUT; @@ -99,6 +102,8 @@ import static org.mockito.Mockito.when; */ public class HttpServerTest { + private static final Logger log = Logger.getLogger(HttpServerTest.class.getName()); + @Rule public TemporaryFolder tmpFolder = new TemporaryFolder(); @@ -669,6 +674,10 @@ public class HttpServerTest { fail("SSLHandshakeException expected"); } catch (SSLHandshakeException e) { assertThat(e.getMessage(), containsString(expectedExceptionSubstring)); + } catch (SSLException e) { + // Jetty may sometime close the connection before the apache client has fully consumed the TLS handshake frame + log.log(Level.WARNING, "Client failed to get a proper TLS handshake response: " + e.getMessage(), e); + assertThat(e.getMessage(), containsString("readHandshakeRecord")); // Only ignore this specific ssl exception } } |