Home / Function/ testRemoteAddress() — netty Function Reference

testRemoteAddress() — netty Function Reference

Architecture documentation for the testRemoteAddress() function in IoUringRemoteIpTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  512132cb_7b44_6088_17a5_3555dd97d5a9["testRemoteAddress()"]
  e9504810_e21f_f4dd_5a70_edbec3f4cab4["IoUringRemoteIpTest"]
  512132cb_7b44_6088_17a5_3555dd97d5a9 -->|defined in| e9504810_e21f_f4dd_5a70_edbec3f4cab4
  79c1e1b7_0eb8_df1f_9ee5_dcbe27a8a998["testRemoteAddressIpv4()"]
  79c1e1b7_0eb8_df1f_9ee5_dcbe27a8a998 -->|calls| 512132cb_7b44_6088_17a5_3555dd97d5a9
  a56bf68e_b63c_47e0_0752_76df52c841c9["testRemoteAddressIpv6()"]
  a56bf68e_b63c_47e0_0752_76df52c841c9 -->|calls| 512132cb_7b44_6088_17a5_3555dd97d5a9
  df5d53b8_57e5_1d2b_62f1_7ac5af5b2548["testRemoteAddressIpv4AndServerAutoDetect()"]
  df5d53b8_57e5_1d2b_62f1_7ac5af5b2548 -->|calls| 512132cb_7b44_6088_17a5_3555dd97d5a9
  1fe66222_e843_44b3_fa8a_7d945356c1eb["testRemoteAddressIpv6ServerAutoDetect()"]
  1fe66222_e843_44b3_fa8a_7d945356c1eb -->|calls| 512132cb_7b44_6088_17a5_3555dd97d5a9
  style 512132cb_7b44_6088_17a5_3555dd97d5a9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport-native-io_uring/src/test/java/io/netty/channel/uring/IoUringRemoteIpTest.java lines 67–115

    private static void testRemoteAddress(InetAddress server, InetAddress client) throws Exception {
        final Promise<SocketAddress> promise = ImmediateEventExecutor.INSTANCE.newPromise();
        EventLoopGroup bossGroup = new MultiThreadIoEventLoopGroup(1, IoUringIoHandler.newFactory());
        Socket socket = new Socket();
        try {
            ServerBootstrap b = new ServerBootstrap();
            b.group(bossGroup)
                    .channel(IoUringServerSocketChannel.class)
                    .childHandler(new ChannelInboundHandlerAdapter() {
                        @Override
                        public void channelActive(ChannelHandlerContext ctx) {
                            promise.setSuccess(ctx.channel().remoteAddress());
                            ctx.close();
                        }
                    });

            // Start the server.
            ChannelFuture f;
            InetSocketAddress connectAddress;
            if (server == null) {
                f = b.bind(0).sync();
                connectAddress = new InetSocketAddress(client,
                        ((InetSocketAddress) f.channel().localAddress()).getPort());
            } else {
                try {
                    f = b.bind(server, 0).sync();
                } catch (Throwable cause) {
                    throw new TestAbortedException("Bind failed, address family not supported ?", cause);
                }
                connectAddress = (InetSocketAddress) f.channel().localAddress();
            }

            try {
                socket.bind(new InetSocketAddress(client, 0));
            } catch (SocketException e) {
                throw new TestAbortedException("Bind failed, address family not supported ?", e);
            }
            socket.connect(connectAddress);

            InetSocketAddress addr = (InetSocketAddress) promise.get();
            assertEquals(socket.getLocalSocketAddress(), addr);
            f.channel().close().sync();
        } finally {
            // Shut down all event loops to terminate all threads.
            bossGroup.shutdownGracefully();

            socket.close();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testRemoteAddress() do?
testRemoteAddress() is a function in the netty codebase, defined in transport-native-io_uring/src/test/java/io/netty/channel/uring/IoUringRemoteIpTest.java.
Where is testRemoteAddress() defined?
testRemoteAddress() is defined in transport-native-io_uring/src/test/java/io/netty/channel/uring/IoUringRemoteIpTest.java at line 67.
What calls testRemoteAddress()?
testRemoteAddress() is called by 4 function(s): testRemoteAddressIpv4, testRemoteAddressIpv4AndServerAutoDetect, testRemoteAddressIpv6, testRemoteAddressIpv6ServerAutoDetect.

Analyze Your Own Codebase

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

Try Supermodel Free