Home / Function/ listenerThrowShouldNotPreventOtherListenersFromBeingNotified() — netty Function Reference

listenerThrowShouldNotPreventOtherListenersFromBeingNotified() — netty Function Reference

Architecture documentation for the listenerThrowShouldNotPreventOtherListenersFromBeingNotified() function in DefaultHttp2ConnectionTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  6f84ccc7_de97_04f6_72a2_a7c659df16fa["listenerThrowShouldNotPreventOtherListenersFromBeingNotified()"]
  8ad19b2d_97df_9c7f_e36e_ed43457889f2["DefaultHttp2ConnectionTest"]
  6f84ccc7_de97_04f6_72a2_a7c659df16fa -->|defined in| 8ad19b2d_97df_9c7f_e36e_ed43457889f2
  c8fe9127_3402_9c69_bc0b_c0c961c0aabb["ListenerExceptionThrower()"]
  6f84ccc7_de97_04f6_72a2_a7c659df16fa -->|calls| c8fe9127_3402_9c69_bc0b_c0c961c0aabb
  41d91661_05ae_b09e_8928_97f88be536e4["ListenerVerifyCallAnswer()"]
  6f84ccc7_de97_04f6_72a2_a7c659df16fa -->|calls| 41d91661_05ae_b09e_8928_97f88be536e4
  style 6f84ccc7_de97_04f6_72a2_a7c659df16fa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionTest.java lines 563–647

    @Test
    public void listenerThrowShouldNotPreventOtherListenersFromBeingNotified() throws Http2Exception {
        final boolean[] calledArray = new boolean[128];
        // The following setup will ensure that clientListener throws exceptions, and marks a value in an array
        // such that clientListener2 will verify that is set or fail the test.
        int methodIndex = 0;
        doAnswer(new ListenerExceptionThrower(calledArray, methodIndex))
            .when(clientListener).onStreamAdded(any(Http2Stream.class));
        doAnswer(new ListenerVerifyCallAnswer(calledArray, methodIndex++))
            .when(clientListener2).onStreamAdded(any(Http2Stream.class));

        doAnswer(new ListenerExceptionThrower(calledArray, methodIndex))
            .when(clientListener).onStreamActive(any(Http2Stream.class));
        doAnswer(new ListenerVerifyCallAnswer(calledArray, methodIndex++))
            .when(clientListener2).onStreamActive(any(Http2Stream.class));

        doAnswer(new ListenerExceptionThrower(calledArray, methodIndex))
            .when(clientListener).onStreamHalfClosed(any(Http2Stream.class));
        doAnswer(new ListenerVerifyCallAnswer(calledArray, methodIndex++))
            .when(clientListener2).onStreamHalfClosed(any(Http2Stream.class));

        doAnswer(new ListenerExceptionThrower(calledArray, methodIndex))
            .when(clientListener).onStreamClosed(any(Http2Stream.class));
        doAnswer(new ListenerVerifyCallAnswer(calledArray, methodIndex++))
            .when(clientListener2).onStreamClosed(any(Http2Stream.class));

        doAnswer(new ListenerExceptionThrower(calledArray, methodIndex))
            .when(clientListener).onStreamRemoved(any(Http2Stream.class));
        doAnswer(new ListenerVerifyCallAnswer(calledArray, methodIndex++))
            .when(clientListener2).onStreamRemoved(any(Http2Stream.class));

        doAnswer(new ListenerExceptionThrower(calledArray, methodIndex))
            .when(clientListener).onGoAwaySent(anyInt(), anyLong(), any(ByteBuf.class));
        doAnswer(new ListenerVerifyCallAnswer(calledArray, methodIndex++))
            .when(clientListener2).onGoAwaySent(anyInt(), anyLong(), any(ByteBuf.class));

        doAnswer(new ListenerExceptionThrower(calledArray, methodIndex))
            .when(clientListener).onGoAwayReceived(anyInt(), anyLong(), any(ByteBuf.class));
        doAnswer(new ListenerVerifyCallAnswer(calledArray, methodIndex++))
            .when(clientListener2).onGoAwayReceived(anyInt(), anyLong(), any(ByteBuf.class));

        doAnswer(new ListenerExceptionThrower(calledArray, methodIndex))
            .when(clientListener).onStreamAdded(any(Http2Stream.class));
        doAnswer(new ListenerVerifyCallAnswer(calledArray, methodIndex++))
            .when(clientListener2).onStreamAdded(any(Http2Stream.class));

        // Now we add clientListener2 and exercise all listener functionality
        try {
            client.addListener(clientListener2);
            Http2Stream stream = client.local().createStream(3, false);
            verify(clientListener).onStreamAdded(any(Http2Stream.class));
            verify(clientListener2).onStreamAdded(any(Http2Stream.class));
            verify(clientListener).onStreamActive(any(Http2Stream.class));
            verify(clientListener2).onStreamActive(any(Http2Stream.class));

            Http2Stream reservedStream = client.remote().reservePushStream(2, stream);
            verify(clientListener, never()).onStreamActive(streamEq(reservedStream));
            verify(clientListener2, never()).onStreamActive(streamEq(reservedStream));

            reservedStream.open(false);
            verify(clientListener).onStreamActive(streamEq(reservedStream));
            verify(clientListener2).onStreamActive(streamEq(reservedStream));

            stream.closeLocalSide();
            verify(clientListener).onStreamHalfClosed(any(Http2Stream.class));
            verify(clientListener2).onStreamHalfClosed(any(Http2Stream.class));

            stream.close();
            verify(clientListener).onStreamClosed(any(Http2Stream.class));
            verify(clientListener2).onStreamClosed(any(Http2Stream.class));
            verify(clientListener).onStreamRemoved(any(Http2Stream.class));
            verify(clientListener2).onStreamRemoved(any(Http2Stream.class));

            client.goAwaySent(client.connectionStream().id(), Http2Error.INTERNAL_ERROR.code(), Unpooled.EMPTY_BUFFER);
            verify(clientListener).onGoAwaySent(anyInt(), anyLong(), any(ByteBuf.class));
            verify(clientListener2).onGoAwaySent(anyInt(), anyLong(), any(ByteBuf.class));

            client.goAwayReceived(client.connectionStream().id(),
                    Http2Error.INTERNAL_ERROR.code(), Unpooled.EMPTY_BUFFER);
            verify(clientListener).onGoAwayReceived(anyInt(), anyLong(), any(ByteBuf.class));
            verify(clientListener2).onGoAwayReceived(anyInt(), anyLong(), any(ByteBuf.class));

Domain

Subdomains

Frequently Asked Questions

What does listenerThrowShouldNotPreventOtherListenersFromBeingNotified() do?
listenerThrowShouldNotPreventOtherListenersFromBeingNotified() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionTest.java.
Where is listenerThrowShouldNotPreventOtherListenersFromBeingNotified() defined?
listenerThrowShouldNotPreventOtherListenersFromBeingNotified() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionTest.java at line 563.
What does listenerThrowShouldNotPreventOtherListenersFromBeingNotified() call?
listenerThrowShouldNotPreventOtherListenersFromBeingNotified() calls 2 function(s): ListenerExceptionThrower, ListenerVerifyCallAnswer.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free