Home / Function/ testLocalAddressBeforeAndAfterBind() — netty Function Reference

testLocalAddressBeforeAndAfterBind() — netty Function Reference

Architecture documentation for the testLocalAddressBeforeAndAfterBind() function in EpollDatagramChannelTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  64595fba_1e3c_9e86_9875_7cac41c8cce6["testLocalAddressBeforeAndAfterBind()"]
  fbe8add9_85f0_e800_9650_c89745ed8cad["EpollDatagramChannelTest"]
  64595fba_1e3c_9e86_9875_7cac41c8cce6 -->|defined in| fbe8add9_85f0_e800_9650_c89745ed8cad
  style 64595fba_1e3c_9e86_9875_7cac41c8cce6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollDatagramChannelTest.java lines 72–98

    @Test
    public void testLocalAddressBeforeAndAfterBind() {
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, EpollIoHandler.newFactory());
        try {
            TestHandler handler = new TestHandler();
            InetSocketAddress localAddressBeforeBind = new InetSocketAddress(LOCALHOST, 0);

            Bootstrap bootstrap = new Bootstrap();
            bootstrap.group(group)
                    .channel(EpollDatagramChannel.class)
                    .localAddress(localAddressBeforeBind)
                    .handler(handler);

            ChannelFuture future = bootstrap.bind().syncUninterruptibly();

            assertNull(handler.localAddress);

            SocketAddress localAddressAfterBind = future.channel().localAddress();
            assertNotNull(localAddressAfterBind);
            assertTrue(localAddressAfterBind instanceof InetSocketAddress);
            assertTrue(((InetSocketAddress) localAddressAfterBind).getPort() != 0);

            future.channel().close().syncUninterruptibly();
        } finally {
            group.shutdownGracefully();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testLocalAddressBeforeAndAfterBind() do?
testLocalAddressBeforeAndAfterBind() is a function in the netty codebase, defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollDatagramChannelTest.java.
Where is testLocalAddressBeforeAndAfterBind() defined?
testLocalAddressBeforeAndAfterBind() is defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollDatagramChannelTest.java at line 72.

Analyze Your Own Codebase

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

Try Supermodel Free