Class NettyClientTest

java.lang.Object
org.apache.kafka.common.network.netty.NettyClientTestBase
org.apache.kafka.common.network.netty.NettyClientTest

public class NettyClientTest extends NettyClientTestBase
  • 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

      @Test public void testSerialMultipleStreamsCreation() throws Exception
      Throws:
      Exception
    • testConcurrentMultipleStreamsCreation

      @Test public void testConcurrentMultipleStreamsCreation() throws Exception
      Throws:
      Exception
    • testSingleStreamMessageExchange

      @Test public void testSingleStreamMessageExchange() throws Exception
      Test if a simple message can be sent and received back using HTTP/2
      Throws:
      Exception
    • testMultipleStreamMessageExchanges

      @Test public void testMultipleStreamMessageExchanges() throws ExecutionException, InterruptedException
      Create multiple streams and send messages on each of them to test the concurrency and if multiple streams can be handled correctly.
      Throws:
      ExecutionException
      InterruptedException
    • testGoAwayNoActiveStreams

      @Test public void testGoAwayNoActiveStreams() throws Exception
      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 public void testGoAwayWithActiveStreams() throws Exception
      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

      @Test public void testConnectionClose() throws Exception
      Test 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.
      Throws:
      Exception
    • testStreamCreationFails

      @Test public void testStreamCreationFails()
      Test if stream creation fails then the client propagates the failure back to the caller.
    • testStreamCreationFailsWithNoMoreStreamIdsException

      @Test public void testStreamCreationFailsWithNoMoreStreamIdsException() throws Exception
      Test if stream creation fails with NoMoreStreamIdsException then the creation is retried on a new connection.
      Throws:
      Exception
    • testNettyStreamCreationPerEventLoop

      @Test public void testNettyStreamCreationPerEventLoop() throws ExecutionException, InterruptedException
      Test 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
      Throws:
      ExecutionException
      InterruptedException
    • testNettyStreamCreationOnNullEventLoop

      @Test public void testNettyStreamCreationOnNullEventLoop() throws Exception
      Throws:
      Exception
    • testNettyStreamCreationWithMaxConnectionsSmallerThanEventLoopGroupSize

      @Test public void testNettyStreamCreationWithMaxConnectionsSmallerThanEventLoopGroupSize() throws Exception
      Throws:
      Exception
    • testNettyStreamCreationWithMaxConnectionsBiggerThanEventLoopGroupSize

      @Test public void testNettyStreamCreationWithMaxConnectionsBiggerThanEventLoopGroupSize() throws Exception
      Throws:
      Exception
    • testConnectionCount

      @Test public void testConnectionCount() throws Exception
      Throws:
      Exception
    • testNoConnectionRetry

      @Test public void testNoConnectionRetry() throws Exception
      Throws:
      Exception
    • testConnectionSucceedsWhenServerAvailable

      @Test public void testConnectionSucceedsWhenServerAvailable() throws Exception
      Throws:
      Exception
    • testConnectionSucceedsAfterPreviousFailure

      @Test public void testConnectionSucceedsAfterPreviousFailure() throws Exception
      Throws:
      Exception
    • testConcurrentStreamCreationWithoutEventLoopPreference

      @Test public void testConcurrentStreamCreationWithoutEventLoopPreference() throws Exception
      Test concurrent stream creation without specifying event loops. All concurrent requests should converge to reuse the same connection(s) rather than creating many new connections.
      Throws:
      Exception
    • testConcurrentStreamCreationWithSingleConnectionPerEventLoop

      @Test public void testConcurrentStreamCreationWithSingleConnectionPerEventLoop() throws Exception
      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 Exception
      Test 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

      @Test public void testConnectionCreationFailureReusesExistingConnection() throws Exception
      Throws:
      Exception
    • testConnectionCreationFailureWithNoExistingConnectionFails

      @Test public void testConnectionCreationFailureWithNoExistingConnectionFails()
    • testMultipleStreamsReuseExistingConnection

      @Test public void testMultipleStreamsReuseExistingConnection() throws Exception
      Throws:
      Exception
    • testStreamCreationAfterConnectionClosed

      @Test public void testStreamCreationAfterConnectionClosed() throws Exception
      Throws:
      Exception
    • testEventLoopAtCapacityReusesExistingConnection

      @Test public void testEventLoopAtCapacityReusesExistingConnection() throws Exception
      Throws:
      Exception
    • testDifferentEventLoopsUseDifferentConnections

      @Test public void testDifferentEventLoopsUseDifferentConnections() throws Exception
      Throws:
      Exception
    • testNullEventLoopPreferencePicksAnyConnection

      @Test public void testNullEventLoopPreferencePicksAnyConnection() throws Exception
      Throws:
      Exception
    • testMultipleConnectionsPerEventLoopUpToLimit

      @Test public void testMultipleConnectionsPerEventLoopUpToLimit() throws Exception
      Throws:
      Exception
    • testStreamCreationFailsWhenServerUnavailable

      @Test public void testStreamCreationFailsWhenServerUnavailable() throws Exception
      Throws:
      Exception
    • testGetConnectionCountsEmptyWhenNoConnections

      @Test public void testGetConnectionCountsEmptyWhenNoConnections()
    • testGetConnectionCountsReturnsCorrectCounts

      @Test public void testGetConnectionCountsReturnsCorrectCounts() throws Exception
      Throws:
      Exception
    • testGetConnectionCountsWithMultipleEventLoops

      @Test public void testGetConnectionCountsWithMultipleEventLoops() throws Exception
      Throws:
      Exception
    • testConnectionListenerReceivesCreateEvent

      @Test public void testConnectionListenerReceivesCreateEvent() throws Exception
      Throws:
      Exception
    • testConnectionListenerReceivesCloseEvent

      @Test public void testConnectionListenerReceivesCloseEvent() throws Exception
      Throws:
      Exception
    • testConnectionListenerReceivesMultipleEvents

      @Test public void testConnectionListenerReceivesMultipleEvents() throws Exception
      Throws:
      Exception
    • testSetConnectionListenerToNullRemovesListener

      @Test public void testSetConnectionListenerToNullRemovesListener() throws Exception
      Throws:
      Exception