Class SelectorTest
java.lang.Object
org.apache.kafka.common.network.SelectorTest
- Direct Known Subclasses:
ReversableSelectorTest, SslSelectorTest
A set of tests for the selector. These use a test harness that runs a simple socket server that echos back responses.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidsetUp()voidtearDown()voidSending a request with one already in flight should result in an exceptionvoidEnsure that no errors are thrown if channels are closed while processing multiple completed receivesvoidvoidvoidvoidvoidvoidvoidvoidvoidTests that a connect and disconnect in a single poll invocation results in the channel id being in `disconnected`, but not `connected`.voidVerify that if Selector#connect fails and throws an Exception, all related objects are cleared immediately before the exception is propagated.voidvoidSending a request to a node not listening on that port should result in disconnectionvoidvoidvoidvoidvoidvoidVerifies that a muted connection closed by peer is expired on idle timeout even if there are pending receives on the socket.voidvoidvoidTests that graceful close of channel processes remaining data from socket read buffers.voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidtestMute()voidvoidSend multiple requests to several connections in parallel.voidSending a request to a node with a bad hostname should result in an exception during connectvoidvoidvoidvoidTests that graceful close is not delayed if only part of an incoming receive is available in the socket buffer.voidvoidvoidTests that completing proxy protocol and disconnecting in a single poll invocation results in the channel id being in `disconnected`, but not `connected`.voidvoidvoidValidate that we can send and receive a message larger than the receive and send buffer sizevoidSending a request to a node without an existing connection should result in an exceptionvoidValidate that when the server disconnects, a client send ends up with that node in the disconnected list.voidvoidvoidvoidvoidvoidstatic voidverifySelectorEmpty(org.apache.kafka.common.network.Selector selector)
-
Constructor Details
-
SelectorTest
public SelectorTest()
-
-
Method Details
-
setUp
-
tearDown
-
testServerDisconnect
-
testCantSendWithInProgress
-
testSendWithoutConnecting
@Test public void testSendWithoutConnecting()Sending a request to a node without an existing connection should result in an exception -
testNoRouteToHost
@Test public void testNoRouteToHost()Sending a request to a node with a bad hostname should result in an exception during connect -
testConnectionRefused
-
testNormalOperation
-
testSendLargeRequest
-
testPartialSendAndReceiveReflectedInMetrics
-
testLargeMessageSequence
-
testEmptyRequest
-
testClearCompletedSendsAndReceives
-
testExistingConnectionId
- Throws:
IOException
-
testMute
-
testCloseAllChannels
-
registerFailure
-
testCloseOldestConnection
-
testIdleExpiryWithoutReadyKeys
-
testImmediatelyConnectedCleaned
-
testConnectException
-
testExpireConnectionWithPendingReceives
-
testExpireClosedConnectionWithPendingReceives
-
testGracefulClose
Tests that graceful close of channel processes remaining data from socket read buffers. Since we cannot determine how much data is available in the buffers, this test verifies that multiple receives are completed after server shuts down connections, with retries to tolerate cases where data may not be available in the socket buffer.- Throws:
Exception
-
testPartialReceiveGracefulClose
-
testMuteOnOOM
-
testConnectDisconnectDuringInSinglePoll
-
testOutboundConnectionsCountInConnectionCreationMetric
-
testInboundConnectionsCountInConnectionCreationMetric
-
testConnectionsByClientMetric
-
testLowestPriorityChannel
-
testMetricsCleanupOnSelectorClose
-
testWriteCompletesSendWithNoBytesWritten
- Throws:
IOException
-
testChannelCloseWhileProcessingReceives
-
testProxyReadyAndDisconnectInSinglePoll
-
testThrottledProxyConnection
-
testConnectionMaxIdleMs
-
testChannelWithInvalidSniHostName
-
testChannelWithMissingSniHostName
-
testInvalidSniMetricOnAuthenticatedConnection
-
testInvalidSniMetricOnUnauthenticatedConnection
-
testSniRejectionConnectionClosedMetric
-
testMissingSniMetricOnAuthenticatedConnection
-
testMissingSniMetricOnUnauthenticatedConnection
-
testInvalidSniMetricOnSuccessWithoutMultiTenantPrincipal
-
testSniMetricsKeyedByTenantAndAuthenticationId
-
testCipherMetricHasNoTenantTagBeforeAuth
@Test public void testCipherMetricHasNoTenantTagBeforeAuth() -
testSuccessfulMultiTenantAuthSwapsTenantTag
@Test public void testSuccessfulMultiTenantAuthSwapsTenantTag() -
testNoSwapWhenCipherNotTracked
@Test public void testNoSwapWhenCipherNotTracked() -
testNoSwapWhenTrackedCiphersEmpty
@Test public void testNoSwapWhenTrackedCiphersEmpty() -
testCloseDecrementsResolvedTenantKey
@Test public void testCloseDecrementsResolvedTenantKey() -
testCloseDecrementsNoTenantKeyWhenAuthNeverHappened
@Test public void testCloseDecrementsNoTenantKeyWhenAuthNeverHappened() -
testFailedAuthLeavesTenantUnresolved
@Test public void testFailedAuthLeavesTenantUnresolved() -
testMaybeRecordIdempotentForSameTenant
@Test public void testMaybeRecordIdempotentForSameTenant() -
testReauthChangesTenant
@Test public void testReauthChangesTenant() -
testMaybeRecordNoOpWhenNoCipher
@Test public void testMaybeRecordNoOpWhenNoCipher() -
testMaybeRecordCipherSwapNoOpForNonMultiTenantPrincipal
@Test public void testMaybeRecordCipherSwapNoOpForNonMultiTenantPrincipal() -
testReverseAndAddDocumentsExistingBehavior
@Test public void testReverseAndAddDocumentsExistingBehavior() -
testSuiteCapacityExhaustionDropsNewTenantSilently
@Test public void testSuiteCapacityExhaustionDropsNewTenantSilently() -
testProxyProtocolConnectionMetrics
-
testErrorDuringConnection
-
verifySelectorEmpty
-
testEarliestMtlsCertExpirationDefaultValue
@Test public void testEarliestMtlsCertExpirationDefaultValue() -
testMtlsCertExpirationTracksMinimum
-
testMtlsCertExpirationResetOnLastClose
-
testMtlsCertExpirationNotResetWhenNonMtlsClosed
-
testMtlsCertExpirationFreshCacheRejectsHigherValue
-
testMtlsCertExpirationStaleCacheOverwrite
-
testMtlsCertExpirationCounterNotAffectedByNonMtlsClose
-