Class KafkaChannelTest
java.lang.Object
org.apache.kafka.common.network.KafkaChannelTest
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final org.apache.kafka.common.network.Authenticatorstatic final Stringstatic final Stringstatic final SNIHostNamestatic final Stringstatic final SNIHostNamestatic final org.apache.kafka.common.network.KafkaChannelstatic final Stringstatic final org.apache.kafka.common.utils.internals.LogContextstatic final InetAddressstatic final intstatic final org.apache.kafka.common.network.ChannelMetadataRegistrystatic final org.apache.kafka.common.utils.Timestatic final org.apache.kafka.common.memory.MemoryPoolstatic final org.apache.kafka.common.network.ProxyTlvProviderstatic final SNIHostNamestatic final org.apache.kafka.common.security.authenticator.SaslServerAuthenticatorstatic final org.apache.kafka.common.security.authenticator.PathAwareSniHostNamestatic final SNIHostNamestatic final Stringstatic final SNIHostNamestatic final Stringstatic final org.apache.kafka.common.network.SslTransportLayerstatic final org.apache.kafka.common.network.TransportLayerstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetUp()voidtearDown()voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidtestIsMTlsAuthenticatedWhenToggleMTlsEnabled(boolean mTlsEnabled) voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidtestUnreadableSocket(org.apache.kafka.common.network.ProxyProtocol proxyProtocolEngineType)
-
Field Details
-
CHANNEL_ID
- See Also:
-
MAX_RECEIVE_SIZE
public static final int MAX_RECEIVE_SIZE- See Also:
-
METADATA_REGISTRY
public static final org.apache.kafka.common.network.ChannelMetadataRegistry METADATA_REGISTRY -
POOL
public static final org.apache.kafka.common.memory.MemoryPool POOL -
TRANSPORT
public static final org.apache.kafka.common.network.TransportLayer TRANSPORT -
AUTHENTICATOR
public static final org.apache.kafka.common.network.Authenticator AUTHENTICATOR -
SSL_TRANSPORT_LAYER
public static final org.apache.kafka.common.network.SslTransportLayer SSL_TRANSPORT_LAYER -
SASL_SERVER_AUTHENTICATOR
public static final org.apache.kafka.common.security.authenticator.SaslServerAuthenticator SASL_SERVER_AUTHENTICATOR -
PROXY_TLV_PROVIDER
public static final org.apache.kafka.common.network.ProxyTlvProvider PROXY_TLV_PROVIDER -
MOCK_TIME
public static final org.apache.kafka.common.utils.Time MOCK_TIME -
LOG_CONTEXT
public static final org.apache.kafka.common.utils.internals.LogContext LOG_CONTEXT -
KAFKA_CHANNEL
public static final org.apache.kafka.common.network.KafkaChannel KAFKA_CHANNEL -
BROKER_PREFIX
- See Also:
-
RAW_SNI_HOST_NAME
-
SNI_HOST_NAME
public static final org.apache.kafka.common.security.authenticator.PathAwareSniHostName SNI_HOST_NAME -
SNI_HOST_NAME_WITH_LKC
-
SNI_HOST_NAME_WITH_LKC_ID
-
LKC_PROXY_ID
- See Also:
-
SNI_HOST_NAME_WITH_PKC_STRING
- See Also:
-
SNI_HOST_NAME_WITH_PKC
-
INVALID_SNI_HOST_NAME_STRING
- See Also:
-
INVALID_SNI_HOST_NAME
-
INVALID_SNI_HOST_NAME_UPPER_CASE
-
VALID_SNI_HOST_NAMES_EXCLUDE_SUFFIX
- See Also:
-
AUTHENTICATION_ID
- See Also:
-
VALID_SNI_HOSTNAMES
-
LOOPBACK_SOCKET_ADDRESS
-
-
Constructor Details
-
KafkaChannelTest
public KafkaChannelTest()
-
-
Method Details
-
setUp
@BeforeEach public void setUp() -
tearDown
@AfterEach public void tearDown() -
testPrepareSetSniHostName
- Throws:
IOException
-
testPrepareSetLkcId
- Throws:
IOException
-
testChannelLkcIdFromProxyProtocol
- Throws:
IOException
-
testChannelWithValidSniHostname
- Throws:
IOException
-
testChannelWithInvalidSniHostname
- Throws:
IOException
-
testChannelWithInvalidSniHostnameUpperCase
- Throws:
IOException
-
testChannelWithEmptySniHostname
- Throws:
IOException
-
testChannelWithInvalidSniHostnameAndValidSniHostNamesExcludeSuffix
@Test public void testChannelWithInvalidSniHostnameAndValidSniHostNamesExcludeSuffix() throws IOException- Throws:
IOException
-
testChannelWithUnparseableSniHostname
- Throws:
IOException
-
testFqdnPropertiesFromProxyProtocolV2
- Throws:
IOException
-
testChannelLkcIdFromSniHeader
- Throws:
IOException
-
testInetAddressToTenantMap
- Throws:
IOException
-
testInetAddressToAPIKeyMap
- Throws:
IOException
-
testSending
- Throws:
IOException
-
testReceiving
- Throws:
IOException
-
testChannelTotalServiceTimeMetrics
- Throws:
IOException
-
testReportClientInformation
@Test public void testReportClientInformation() -
testSocketAddressWithoutProxyProtocol
- Throws:
IOException
-
testSocketAddressWithLat
- Throws:
IOException
-
testSocketAddressWithProxyProtocol
- Throws:
IOException
-
testUnreadableSocket
@ParameterizedTest @EnumSource(value=org.apache.kafka.common.network.ProxyProtocol.class, names={"V1","V2","COMBINED"}) public void testUnreadableSocket(org.apache.kafka.common.network.ProxyProtocol proxyProtocolEngineType) throws IOException - Throws:
IOException
-
testRequestSequenceId
- Throws:
IOException
-
testOneRequestLogPerConnection
- Throws:
IOException
-
testPrepareSniParsingWithSslAuthenticator
- Throws:
IOException
-
testPrepareSniPassedToSslAuthenticator
- Throws:
IOException
-
testPrepareSniNotPassedWhenDisabled
- Throws:
IOException
-
testPrepareSniParsingDisabledWithSslAuthenticator
- Throws:
IOException
-
testPrepareNoSniWithSslAuthenticatorNotEnforced
- Throws:
IOException
-
testLkcIdFromProxyNotSetForSslAuthenticator
- Throws:
IOException
-
testSaslPathInvalidSniRejectedThrows
@Test public void testSaslPathInvalidSniRejectedThrows() -
testSaslPathInvalidSniExemptTenantNotRejected
- Throws:
IOException
-
testSaslPathMissingSniRejectedThrows
@Test public void testSaslPathMissingSniRejectedThrows() -
testSaslPathMissingSniExemptTenantNotRejected
- Throws:
IOException
-
testSaslPathAuthFailureTakesPrecedenceOverSniRejection
- Throws:
IOException
-
testIsMTlsAuthenticatedDefaultFalse
@Test public void testIsMTlsAuthenticatedDefaultFalse() -
testIsMTlsAuthenticatedWhenToggleMTlsEnabled
@ParameterizedTest(name="{displayName}.mtls_enabled={0}") @ValueSource(booleans={true,false}) public void testIsMTlsAuthenticatedWhenToggleMTlsEnabled(boolean mTlsEnabled) throws IOException - Throws:
IOException
-
testGetClientCertExpirationMsDefaultValue
@Test public void testGetClientCertExpirationMsDefaultValue() -
testGetClientCertExpirationMsWithMTlsCert
-
testGetClientCertExpirationMsWithSslPeerUnverified
-
testGetClientCertExpirationMsWithNonMTls
- Throws:
IOException
-
testPrepareWithAltLkcResolverNull
- Throws:
IOException
-
testPrepareWithAltLkcResolverReturnsLkc
- Throws:
IOException
-
testPrepareWithAltLkcResolverReturnsNull
- Throws:
IOException
-
testPrepareWithAltLkcResolverThrowsException
@Test public void testPrepareWithAltLkcResolverThrowsException() -
testPrepareWithAltLkcResolverReceivesCorrectHostname
- Throws:
IOException
-
testReverseChannelPreservesAltLkcResolver
-