Home / Function/ closeListenerShouldBeNotifiedOnlyOneTime() — netty Function Reference

closeListenerShouldBeNotifiedOnlyOneTime() — netty Function Reference

Architecture documentation for the closeListenerShouldBeNotifiedOnlyOneTime() function in Http2ConnectionHandlerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  0d0d98c3_f3c2_266e_c0d1_18af6da5a668["closeListenerShouldBeNotifiedOnlyOneTime()"]
  e8b32c7d_fa9d_422b_0744_82047ac00ea5["Http2ConnectionHandlerTest"]
  0d0d98c3_f3c2_266e_c0d1_18af6da5a668 -->|defined in| e8b32c7d_fa9d_422b_0744_82047ac00ea5
  style 0d0d98c3_f3c2_266e_c0d1_18af6da5a668 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionHandlerTest.java lines 599–631

    @SuppressWarnings("unchecked")
    @Test
    public void closeListenerShouldBeNotifiedOnlyOneTime() throws Exception {
        handler = newHandler();
        when(future.isDone()).thenReturn(true);
        when(future.isSuccess()).thenReturn(true);
        doAnswer(new Answer<ChannelFuture>() {
            @Override
            public ChannelFuture answer(InvocationOnMock invocation) throws Throwable {
                Object[] args = invocation.getArguments();
                GenericFutureListener<ChannelFuture> listener = (GenericFutureListener<ChannelFuture>) args[0];
                // Simulate that all streams have become inactive by the time the future completes.
                doAnswer(new Answer<Http2Stream>() {
                    @Override
                    public Http2Stream answer(InvocationOnMock in) throws Throwable {
                        return null;
                    }
                }).when(connection).forEachActiveStream(any(Http2StreamVisitor.class));
                when(connection.numActiveStreams()).thenReturn(0);
                // Simulate the future being completed.
                listener.operationComplete(future);
                return future;
            }
        }).when(future).addListener(any(GenericFutureListener.class));
        handler.close(ctx, promise);
        if (future.isDone()) {
            when(connection.numActiveStreams()).thenReturn(0);
        }
        handler.closeStream(stream, future);
        // Simulate another stream close call being made after the context should already be closed.
        handler.closeStream(stream, future);
        verify(ctx, times(1)).close(any(ChannelPromise.class));
    }

Domain

Subdomains

Frequently Asked Questions

What does closeListenerShouldBeNotifiedOnlyOneTime() do?
closeListenerShouldBeNotifiedOnlyOneTime() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionHandlerTest.java.
Where is closeListenerShouldBeNotifiedOnlyOneTime() defined?
closeListenerShouldBeNotifiedOnlyOneTime() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionHandlerTest.java at line 599.

Analyze Your Own Codebase

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

Try Supermodel Free