From dd2ca88cbdb16a1a9ff2facb9fedd579b7c8d09f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20Op=C3=A1lka?= Date: Fri, 12 Jan 2024 12:11:34 +0100 Subject: [PATCH 1/2] Revert "[WFCORE-6538] ClosedChannelException is thrown intermittently instead of SaslException when using GS2_KRB5 with TLS" This reverts commit 4bda9827c0e1394fa4d617a36740433997c3ba23. --- .../AbstractKerberosMgmtSaslTestBase.java | 45 ++++++------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/testsuite/elytron/src/test/java/org/wildfly/test/integration/elytron/sasl/mgmt/AbstractKerberosMgmtSaslTestBase.java b/testsuite/elytron/src/test/java/org/wildfly/test/integration/elytron/sasl/mgmt/AbstractKerberosMgmtSaslTestBase.java index 0ecb0d77100..aa338bd0ad7 100644 --- a/testsuite/elytron/src/test/java/org/wildfly/test/integration/elytron/sasl/mgmt/AbstractKerberosMgmtSaslTestBase.java +++ b/testsuite/elytron/src/test/java/org/wildfly/test/integration/elytron/sasl/mgmt/AbstractKerberosMgmtSaslTestBase.java @@ -19,7 +19,6 @@ import java.io.IOException; import java.net.ConnectException; import java.net.MalformedURLException; -import java.nio.channels.ClosedChannelException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.security.GeneralSecurityException; @@ -342,37 +341,19 @@ protected void assertAuthenticationFails(String message, Class System.currentTimeMillis()); - Throwable cause = e.getCause(); - assertThat("ConnectionException was expected as a cause when authentication fails", cause, - is(instanceOf(ConnectException.class))); - - // if execution ends with ClosedChannelException during first run, run once again - if (i == 0 && cause.getCause() instanceof ClosedChannelException) { - LOGGER.warn("ClosedChannelException detected, probably because of the bug in SSLEngine. Because this happens very rarely, attempt to execute the op again"); - continue; - } - assertThat("Unexpected type of inherited exception for authentication failure", cause.getCause(), - anyOf(is(instanceOf(SSLException.class)), is(instanceOf(SaslException.class)), - is(instanceOf(RedirectException.class)))); - } - // if execution succeeds, there is no need to run again - break; + final long startTime = System.currentTimeMillis(); + try { + executeWhoAmI(withTls); + fail(message); + } catch (IOException | GeneralSecurityException e) { + assertTrue("Connection reached its timeout (hang).", + startTime + CONNECTION_TIMEOUT_IN_MS > System.currentTimeMillis()); + Throwable cause = e.getCause(); + assertThat("ConnectionException was expected as a cause when authentication fails", cause, + is(instanceOf(ConnectException.class))); + assertThat("Unexpected type of inherited exception for authentication failure", cause.getCause(), + anyOf(is(instanceOf(SSLException.class)), is(instanceOf(SaslException.class)), + is(instanceOf(RedirectException.class)))); } } From be64de17b065ebcf63b5739571f62e45a86c9598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20Op=C3=A1lka?= Date: Fri, 12 Jan 2024 12:13:26 +0100 Subject: [PATCH 2/2] [WFCORE-6538] Prepare for upcoming JBoss Remoting & XNIO releases where peer shut down is propagated to XNIO & Remoting. --- .../elytron/sasl/mgmt/AbstractKerberosMgmtSaslTestBase.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/elytron/src/test/java/org/wildfly/test/integration/elytron/sasl/mgmt/AbstractKerberosMgmtSaslTestBase.java b/testsuite/elytron/src/test/java/org/wildfly/test/integration/elytron/sasl/mgmt/AbstractKerberosMgmtSaslTestBase.java index aa338bd0ad7..38daef43c28 100644 --- a/testsuite/elytron/src/test/java/org/wildfly/test/integration/elytron/sasl/mgmt/AbstractKerberosMgmtSaslTestBase.java +++ b/testsuite/elytron/src/test/java/org/wildfly/test/integration/elytron/sasl/mgmt/AbstractKerberosMgmtSaslTestBase.java @@ -19,6 +19,7 @@ import java.io.IOException; import java.net.ConnectException; import java.net.MalformedURLException; +import java.nio.channels.ClosedChannelException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.security.GeneralSecurityException; @@ -353,7 +354,7 @@ protected void assertAuthenticationFails(String message, Class