diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java index e031675e799..212fadf632d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java @@ -18,6 +18,7 @@ package org.springframework.boot.web.embedded.undertow; import java.io.File; import java.io.IOException; +import java.net.SocketException; import java.net.URISyntaxException; import java.nio.charset.Charset; import java.util.Arrays; @@ -50,6 +51,8 @@ import org.springframework.http.HttpStatus; import org.springframework.test.util.ReflectionTestUtils; import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.CoreMatchers.anyOf; +import static org.hamcrest.CoreMatchers.instanceOf; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; @@ -208,14 +211,18 @@ public class UndertowServletWebServerFactoryTests (builder) -> builder.addHttpListener(port, "0.0.0.0")); } - @Test(expected = SSLHandshakeException.class) + @Test public void sslRestrictedProtocolsEmptyCipherFailure() throws Exception { + this.thrown.expect(anyOf(instanceOf(SSLHandshakeException.class), + instanceOf(SocketException.class))); testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1.2" }, new String[] { "TLS_EMPTY_RENEGOTIATION_INFO_SCSV" }); } - @Test(expected = SSLException.class) + @Test public void sslRestrictedProtocolsECDHETLS1Failure() throws Exception { + this.thrown.expect(anyOf(instanceOf(SSLException.class), + instanceOf(SocketException.class))); testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1" }, new String[] { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" }); } @@ -232,8 +239,10 @@ public class UndertowServletWebServerFactoryTests new String[] { "TLS_RSA_WITH_AES_128_CBC_SHA256" }); } - @Test(expected = SSLException.class) + @Test public void sslRestrictedProtocolsRSATLS11Failure() throws Exception { + this.thrown.expect(anyOf(instanceOf(SSLException.class), + instanceOf(SocketException.class))); testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1.1" }, new String[] { "TLS_RSA_WITH_AES_128_CBC_SHA256" }); }