Home / Function/ testStreamIsNotCreatedIfParentConnectionIsClosedConcurrently() — netty Function Reference

testStreamIsNotCreatedIfParentConnectionIsClosedConcurrently() — netty Function Reference

Architecture documentation for the testStreamIsNotCreatedIfParentConnectionIsClosedConcurrently() function in Http2StreamChannelBootstrapTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  768ceffc_b61a_dc82_8899_9268f03c871d["testStreamIsNotCreatedIfParentConnectionIsClosedConcurrently()"]
  50eedf11_f660_dc20_71c5_c1d7bf019f90["Http2StreamChannelBootstrapTest"]
  768ceffc_b61a_dc82_8899_9268f03c871d -->|defined in| 50eedf11_f660_dc20_71c5_c1d7bf019f90
  563e09b0_5a75_8d0e_fff1_ead4c30f71fe["safeClose()"]
  768ceffc_b61a_dc82_8899_9268f03c871d -->|calls| 563e09b0_5a75_8d0e_fff1_ead4c30f71fe
  style 768ceffc_b61a_dc82_8899_9268f03c871d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrapTest.java lines 58–127

    @Test
    public void testStreamIsNotCreatedIfParentConnectionIsClosedConcurrently() throws Exception {
        EventLoopGroup group = null;
        Channel serverChannel = null;
        Channel clientChannel = null;
        try {
            final CountDownLatch serverChannelLatch = new CountDownLatch(1);
            group = new DefaultEventLoop();
            LocalAddress serverAddress = new LocalAddress(getClass().getName());
            ServerBootstrap sb = new ServerBootstrap()
                    .channel(LocalServerChannel.class)
                    .group(group)
                    .childHandler(new ChannelInitializer<Channel>() {
                        @Override
                        protected void initChannel(Channel ch) {
                            serverConnectedChannel = ch;
                            ch.pipeline().addLast(forServer().build(), newMultiplexedHandler());
                            serverChannelLatch.countDown();
                        }
                    });
            serverChannel = sb.bind(serverAddress).sync().channel();

            Bootstrap cb = new Bootstrap()
                    .channel(LocalChannel.class)
                    .group(group)
                    .handler(new ChannelInitializer<Channel>() {
                        @Override
                        protected void initChannel(Channel ch) {
                            ch.pipeline().addLast(forClient().build(), newMultiplexedHandler());
                        }
                    });
            clientChannel = cb.connect(serverAddress).sync().channel();
            assertTrue(serverChannelLatch.await(3, SECONDS));

            final CountDownLatch closeLatch = new CountDownLatch(1);
            final Channel clientChannelToClose = clientChannel;
            group.execute(new Runnable() {
                @Override
                public void run() {
                    try {
                        closeLatch.await();
                        clientChannelToClose.close().syncUninterruptibly();
                    } catch (InterruptedException e) {
                        logger.error(e);
                    }
                }
            });

            Http2StreamChannelBootstrap bootstrap = new Http2StreamChannelBootstrap(clientChannel);
            final Promise<Http2StreamChannel> promise = clientChannel.eventLoop().newPromise();
            bootstrap.open(promise);
            assertFalse(promise.isDone());
            closeLatch.countDown();

            ExecutionException exception = assertThrows(ExecutionException.class, new Executable() {
                @Override
                public void execute() throws Throwable {
                    promise.get(3, SECONDS);
                }
            });
            assertInstanceOf(ClosedChannelException.class, exception.getCause());
        } finally {
            safeClose(clientChannel);
            safeClose(serverConnectedChannel);
            safeClose(serverChannel);
            if (group != null) {
                group.shutdownGracefully(0, 3, SECONDS);
            }
        }
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does testStreamIsNotCreatedIfParentConnectionIsClosedConcurrently() do?
testStreamIsNotCreatedIfParentConnectionIsClosedConcurrently() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrapTest.java.
Where is testStreamIsNotCreatedIfParentConnectionIsClosedConcurrently() defined?
testStreamIsNotCreatedIfParentConnectionIsClosedConcurrently() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrapTest.java at line 58.
What does testStreamIsNotCreatedIfParentConnectionIsClosedConcurrently() call?
testStreamIsNotCreatedIfParentConnectionIsClosedConcurrently() calls 1 function(s): safeClose.

Analyze Your Own Codebase

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

Try Supermodel Free