Home / Function/ testLateRegisterSuccessBindFailed() — netty Function Reference

testLateRegisterSuccessBindFailed() — netty Function Reference

Architecture documentation for the testLateRegisterSuccessBindFailed() function in BootstrapTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  76618058_54f9_1ad0_d1bf_f6bda033b31e["testLateRegisterSuccessBindFailed()"]
  7a7606db_8d2a_bfe0_9993_4aaa8e0a6e42["BootstrapTest"]
  76618058_54f9_1ad0_d1bf_f6bda033b31e -->|defined in| 7a7606db_8d2a_bfe0_9993_4aaa8e0a6e42
  be3f678c_5460_042e_17d7_4c0d5f273e01["TestEventLoopGroup()"]
  76618058_54f9_1ad0_d1bf_f6bda033b31e -->|calls| be3f678c_5460_042e_17d7_4c0d5f273e01
  style 76618058_54f9_1ad0_d1bf_f6bda033b31e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/bootstrap/BootstrapTest.java lines 259–306

    @Test
    public void testLateRegisterSuccessBindFailed() throws Exception {
        TestEventLoopGroup group = new TestEventLoopGroup();
        try {
            ServerBootstrap bootstrap = new ServerBootstrap();
            bootstrap.group(group);
            bootstrap.channelFactory(new ChannelFactory<ServerChannel>() {
                @Override
                public ServerChannel newChannel() {
                    return new LocalServerChannel() {
                        @Override
                        public ChannelFuture bind(SocketAddress localAddress) {
                            // Close the Channel to emulate what NIO and others impl do on bind failure
                            // See https://github.com/netty/netty/issues/2586
                            close();
                            return newFailedFuture(new SocketException());
                        }

                        @Override
                        public ChannelFuture bind(SocketAddress localAddress, ChannelPromise promise) {
                            // Close the Channel to emulate what NIO and others impl do on bind failure
                            // See https://github.com/netty/netty/issues/2586
                            close();
                            return promise.setFailure(new SocketException());
                        }
                    };
                }
            });
            bootstrap.childHandler(new DummyHandler());
            bootstrap.localAddress(new LocalAddress("1"));
            ChannelFuture future = bootstrap.bind();
            assertFalse(future.isDone());
            group.promise.setSuccess();
            final BlockingQueue<Boolean> queue = new LinkedBlockingQueue<Boolean>();
            future.addListener(new ChannelFutureListener() {
                @Override
                public void operationComplete(ChannelFuture future) throws Exception {
                    queue.add(future.channel().eventLoop().inEventLoop(Thread.currentThread()));
                    queue.add(future.isSuccess());
                }
            });
            assertTrue(queue.take());
            assertFalse(queue.take());
        } finally {
            group.shutdownGracefully();
            group.terminationFuture().sync();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testLateRegisterSuccessBindFailed() do?
testLateRegisterSuccessBindFailed() is a function in the netty codebase, defined in transport/src/test/java/io/netty/bootstrap/BootstrapTest.java.
Where is testLateRegisterSuccessBindFailed() defined?
testLateRegisterSuccessBindFailed() is defined in transport/src/test/java/io/netty/bootstrap/BootstrapTest.java at line 259.
What does testLateRegisterSuccessBindFailed() call?
testLateRegisterSuccessBindFailed() calls 1 function(s): TestEventLoopGroup.

Analyze Your Own Codebase

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

Try Supermodel Free