Skip to content

Commit 9ce5038

Browse files
committed
Add extra option for timeout exception in test
1 parent d3f6c72 commit 9ce5038

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

msal4j-sdk/src/integrationtest/java/com.microsoft.aad.msal4j/HttpClientIT.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import static org.junit.jupiter.api.Assertions.assertEquals;
1616
import static org.junit.jupiter.api.Assertions.assertNotNull;
1717
import static org.junit.jupiter.api.Assertions.assertThrows;
18+
import static org.junit.jupiter.api.Assertions.assertTrue;
1819

1920
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
2021
class HttpClientIT {
@@ -81,6 +82,8 @@ private void assertAcquireTokenCommon_WithTimeout(User user, int readTimeout)
8182
.build())
8283
.get());
8384

84-
assertEquals("com.microsoft.aad.msal4j.MsalClientException: java.net.SocketTimeoutException: Read timed out", ex.getMessage());
85+
//The timeout may occur during either the connection attempt (SocketTimeoutException) or the SSL handshake (SSLException)
86+
assertTrue(ex.getMessage().equals("com.microsoft.aad.msal4j.MsalClientException: java.net.SocketTimeoutException: Read timed out") ||
87+
ex.getMessage().equals("com.microsoft.aad.msal4j.MsalClientException: javax.net.ssl.SSLException: Read timed out"));
8588
}
8689
}

0 commit comments

Comments
 (0)