Skip to content

Commit 759e04e

Browse files
committed
Update SSLReloadIntegTests to work with JDK11 (#34129)
In prior versions of Java, we expected to see a SSLHandshakeException when starting a handshake with a server that we do not trust. In JDK11, the exception has changed to a SSLException, which SSLHandshakeException extends. This is most likely a side effect of the TLS 1.3 changes in JDK11. This change updates the test to catch the SSLException instead of the SSLHandshakeException and enables the test to work on JDK8 through JDK11. Closes #32293
1 parent fa28d1c commit 759e04e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/ssl/SSLReloadIntegTests.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
*/
66
package org.elasticsearch.xpack.ssl;
77

8-
98
import org.elasticsearch.ElasticsearchException;
10-
import org.elasticsearch.bootstrap.JavaVersion;
119
import org.elasticsearch.common.settings.MockSecureSettings;
1210
import org.elasticsearch.common.settings.Settings;
1311
import org.elasticsearch.common.transport.TransportAddress;
@@ -17,7 +15,7 @@
1715
import org.elasticsearch.xpack.core.ssl.SSLConfiguration;
1816
import org.elasticsearch.xpack.core.ssl.SSLService;
1917

20-
import javax.net.ssl.SSLHandshakeException;
18+
import javax.net.ssl.SSLException;
2119
import javax.net.ssl.SSLSocket;
2220
import javax.net.ssl.SSLSocketFactory;
2321
import java.io.IOException;
@@ -92,7 +90,6 @@ protected boolean transportSSLEnabled() {
9290
}
9391

9492
public void testThatSSLConfigurationReloadsOnModification() throws Exception {
95-
assumeFalse("test fails on JDK 11 currently", JavaVersion.current().compareTo(JavaVersion.parse("11")) < 0);
9693
Path keyPath = createTempDir().resolve("testnode_updated.pem");
9794
Path certPath = createTempDir().resolve("testnode_updated.crt");
9895
Files.copy(getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode_updated.pem"), keyPath);
@@ -118,7 +115,7 @@ public void testThatSSLConfigurationReloadsOnModification() throws Exception {
118115
assertThat(socket.isConnected(), is(true));
119116
socket.startHandshake();
120117
fail("handshake should not have been successful!");
121-
} catch (SSLHandshakeException | SocketException expected) {
118+
} catch (SSLException | SocketException expected) {
122119
logger.trace("expected exception", expected);
123120
}
124121
// Copy testnode_updated.crt to the placeholder updateable.crt so that the nodes will start trusting it now

0 commit comments

Comments
 (0)