Class NettyClientTest
java.lang.Object
org.apache.kafka.common.network.netty.NettyClientTestBase
org.apache.kafka.common.network.netty.NettyClientTest
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetupClient(org.junit.jupiter.api.TestInfo testInfo) voidvoidvoidTest concurrent stream creation with maxConnectionsPerEventLoop=2 and 3 event loops.voidTest concurrent stream creation without specifying event loops.voidTest concurrent stream creation with maxConnectionsPerEventLoop=1 and 4 event loops.voidTest if existing http/2 connection gets closed we use a new connection for creation of new streams and don't get stuck trying to create a new stream on existing closed connection.voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidTest if existing http/2 connection sends a GOAWAY frame we use a new connection for creation of new streams.voidTest if existing http/2 connection sends a GOAWAY frame we use a new connection for creation of new streams.voidvoidTest if the client shutdown method is idempotent.voidCreate multiple streams and send messages on each of them to test the concurrency and if multiple streams can be handled correctly.voidvoidvoidTest if NettyClient creates a new stream for each event loop if the event loop is specified in the request.voidvoidvoidvoidvoidvoidvoidvoidTest if a simple message can be sent and received back using HTTP/2voidvoidTest if stream creation fails then the client propagates the failure back to the caller.voidvoidTest if stream creation fails with NoMoreStreamIdsException then the creation is retried on a new connection.Methods inherited from class NettyClientTestBase
acceptAllSslContext, createStreamRequest, createStreamRequest, serverAddress
-
Constructor Details
-
NettyClientTest
public NettyClientTest()
-
-
Method Details
-
setupClient
@BeforeEach public void setupClient(org.junit.jupiter.api.TestInfo testInfo) -
shutdownClient
@AfterEach public void shutdownClient() -
testDefaultConstructorUsesDefaultTcpKeepAliveOptions
@Test public void testDefaultConstructorUsesDefaultTcpKeepAliveOptions() -
testCustomTcpKeepAliveOptionsArePreserved
@Test public void testCustomTcpKeepAliveOptionsArePreserved() -
testNullTcpKeepAliveOptionsRejected
@Test public void testNullTcpKeepAliveOptionsRejected() -
testMultipleShutdown
@Test public void testMultipleShutdown()Test if the client shutdown method is idempotent. -
testSerialMultipleStreamsCreation
-
testConcurrentMultipleStreamsCreation
-
testSingleStreamMessageExchange
-
testMultipleStreamMessageExchanges
@Test public void testMultipleStreamMessageExchanges() throws ExecutionException, InterruptedExceptionCreate multiple streams and send messages on each of them to test the concurrency and if multiple streams can be handled correctly. -
testGoAwayNoActiveStreams
Test if existing http/2 connection sends a GOAWAY frame we use a new connection for creation of new streams.
In addition, also check that the current connection that sent GOAWAY closes as there is no currently active streams.- Throws:
Exception
-
testGoAwayWithActiveStreams
Test if existing http/2 connection sends a GOAWAY frame we use a new connection for creation of new streams.
In addition, also check that the current connection that sent GOAWAY only closes once we close the active streams.- Throws:
Exception
-
testConnectionClose
-
testStreamCreationFails
@Test public void testStreamCreationFails()Test if stream creation fails then the client propagates the failure back to the caller. -
testStreamCreationFailsWithNoMoreStreamIdsException
-
testNettyStreamCreationPerEventLoop
@Test public void testNettyStreamCreationPerEventLoop() throws ExecutionException, InterruptedExceptionTest if NettyClient creates a new stream for each event loop if the event loop is specified in the request. In addition, create one with null event loop and check it returns one from the existing connections that it already created. Note: this test is still valid because the default maxConnections is 1 -
testNettyStreamCreationOnNullEventLoop
-
testNettyStreamCreationWithMaxConnectionsSmallerThanEventLoopGroupSize
-
testNettyStreamCreationWithMaxConnectionsBiggerThanEventLoopGroupSize
-
testConnectionCount
-
testNoConnectionRetry
-
testConnectionSucceedsWhenServerAvailable
-
testConnectionSucceedsAfterPreviousFailure
-
testConcurrentStreamCreationWithoutEventLoopPreference
-
testConcurrentStreamCreationWithSingleConnectionPerEventLoop
Test concurrent stream creation with maxConnectionsPerEventLoop=1 and 4 event loops. Expects exactly 4 connections to be created (one per event loop). This test explicitly specifies event loops for requests to verify connection pooling. Note: @MaxConnections(4) with 4 event loops = 4/4 = 1 connection per event loop- Throws:
Exception
-
testConcurrentStreamCreationWithMultipleConnectionsPerEventLoop
@Test public void testConcurrentStreamCreationWithMultipleConnectionsPerEventLoop() throws ExceptionTest concurrent stream creation with maxConnectionsPerEventLoop=2 and 3 event loops. Expects exactly 6 connections to be created (2 per event loop * 3 event loops). This test explicitly specifies event loops for requests to force multiple connections per event loop. Note: @MaxConnections(6) with 3 event loops = 6/3 = 2 connections per event loop- Throws:
Exception
-
testConnectionCreationFailureReusesExistingConnection
-
testConnectionCreationFailureWithNoExistingConnectionFails
@Test public void testConnectionCreationFailureWithNoExistingConnectionFails() -
testMultipleStreamsReuseExistingConnection
-
testStreamCreationAfterConnectionClosed
-
testEventLoopAtCapacityReusesExistingConnection
-
testDifferentEventLoopsUseDifferentConnections
-
testNullEventLoopPreferencePicksAnyConnection
-
testMultipleConnectionsPerEventLoopUpToLimit
-
testGetConnectionCountsEmptyWhenNoConnections
@Test public void testGetConnectionCountsEmptyWhenNoConnections() -
testGetConnectionCountsReturnsCorrectCounts
-
testGetConnectionCountsWithMultipleEventLoops
-
testConnectionListenerReceivesCreateEvent
-
testConnectionListenerReceivesCloseEvent
-
testConnectionListenerReceivesMultipleEvents
-
testSetConnectionListenerToNullRemovesListener
-