use of org.apache.kafka.common.network.ChannelState in project apache-kafka-on-k8s by banzaicloud.
the class SaslAuthenticatorTest method createAndCheckClientConnectionFailure.
private ChannelState createAndCheckClientConnectionFailure(SecurityProtocol securityProtocol, String node) throws Exception {
createClientConnection(securityProtocol, node);
ChannelState finalState = NetworkTestUtils.waitForChannelClose(selector, node, ChannelState.State.AUTHENTICATION_FAILED);
selector.close();
selector = null;
return finalState;
}
use of org.apache.kafka.common.network.ChannelState in project kafka by apache.
the class SaslAuthenticatorFailureDelayTest method createAndCheckClientAuthenticationFailure.
private void createAndCheckClientAuthenticationFailure(SecurityProtocol securityProtocol, String node, String mechanism, String expectedErrorMessage) throws Exception {
ChannelState finalState = createAndCheckClientConnectionFailure(securityProtocol, node);
Exception exception = finalState.exception();
assertTrue(exception instanceof SaslAuthenticationException, "Invalid exception class " + exception.getClass());
if (expectedErrorMessage == null)
expectedErrorMessage = "Authentication failed during authentication due to invalid credentials with SASL mechanism " + mechanism;
assertEquals(expectedErrorMessage, exception.getMessage());
}
use of org.apache.kafka.common.network.ChannelState in project kafka by apache.
the class SaslAuthenticatorTest method createAndCheckClientAuthenticationFailure.
private void createAndCheckClientAuthenticationFailure(SecurityProtocol securityProtocol, String node, String mechanism, String expectedErrorMessage) throws Exception {
ChannelState finalState = createAndCheckClientConnectionFailure(securityProtocol, node);
Exception exception = finalState.exception();
assertTrue(exception instanceof SaslAuthenticationException, "Invalid exception class " + exception.getClass());
String expectedExceptionMessage = expectedErrorMessage != null ? expectedErrorMessage : "Authentication failed during authentication due to invalid credentials with SASL mechanism " + mechanism;
assertEquals(expectedExceptionMessage, exception.getMessage());
}
use of org.apache.kafka.common.network.ChannelState in project apache-kafka-on-k8s by banzaicloud.
the class SaslAuthenticatorTest method createAndCheckClientAuthenticationFailure.
private void createAndCheckClientAuthenticationFailure(SecurityProtocol securityProtocol, String node, String mechanism, String expectedErrorMessage) throws Exception {
ChannelState finalState = createAndCheckClientConnectionFailure(securityProtocol, node);
Exception exception = finalState.exception();
assertTrue("Invalid exception class " + exception.getClass(), exception instanceof SaslAuthenticationException);
if (expectedErrorMessage == null)
expectedErrorMessage = "Authentication failed due to invalid credentials with SASL mechanism " + mechanism;
assertEquals(expectedErrorMessage, exception.getMessage());
}
use of org.apache.kafka.common.network.ChannelState in project kafka by apache.
the class SaslAuthenticatorTest method createAndCheckClientConnectionFailure.
private ChannelState createAndCheckClientConnectionFailure(SecurityProtocol securityProtocol, String node) throws Exception {
try {
createClientConnection(securityProtocol, node);
ChannelState finalState = NetworkTestUtils.waitForChannelClose(selector, node, ChannelState.State.AUTHENTICATION_FAILED);
return finalState;
} finally {
closeClientConnectionIfNecessary();
}
}
Aggregations