IoUringRemoteIpTest Class — netty Architecture
Architecture documentation for the IoUringRemoteIpTest class in IoUringRemoteIpTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD e9504810_e21f_f4dd_5a70_edbec3f4cab4["IoUringRemoteIpTest"] bfeb23a7_21a8_ea42_bd57_2d4210873dc7["IoUringRemoteIpTest.java"] e9504810_e21f_f4dd_5a70_edbec3f4cab4 -->|defined in| bfeb23a7_21a8_ea42_bd57_2d4210873dc7 eb2cc77f_99ce_c80c_b8dc_cf0f6ff8dee3["loadJNI()"] e9504810_e21f_f4dd_5a70_edbec3f4cab4 -->|method| eb2cc77f_99ce_c80c_b8dc_cf0f6ff8dee3 79c1e1b7_0eb8_df1f_9ee5_dcbe27a8a998["testRemoteAddressIpv4()"] e9504810_e21f_f4dd_5a70_edbec3f4cab4 -->|method| 79c1e1b7_0eb8_df1f_9ee5_dcbe27a8a998 a56bf68e_b63c_47e0_0752_76df52c841c9["testRemoteAddressIpv6()"] e9504810_e21f_f4dd_5a70_edbec3f4cab4 -->|method| a56bf68e_b63c_47e0_0752_76df52c841c9 df5d53b8_57e5_1d2b_62f1_7ac5af5b2548["testRemoteAddressIpv4AndServerAutoDetect()"] e9504810_e21f_f4dd_5a70_edbec3f4cab4 -->|method| df5d53b8_57e5_1d2b_62f1_7ac5af5b2548 1fe66222_e843_44b3_fa8a_7d945356c1eb["testRemoteAddressIpv6ServerAutoDetect()"] e9504810_e21f_f4dd_5a70_edbec3f4cab4 -->|method| 1fe66222_e843_44b3_fa8a_7d945356c1eb 512132cb_7b44_6088_17a5_3555dd97d5a9["testRemoteAddress()"] e9504810_e21f_f4dd_5a70_edbec3f4cab4 -->|method| 512132cb_7b44_6088_17a5_3555dd97d5a9
Relationship Graph
Source Code
transport-native-io_uring/src/test/java/io/netty/channel/uring/IoUringRemoteIpTest.java lines 40–116
public class IoUringRemoteIpTest {
@BeforeAll
public static void loadJNI() {
Assumptions.assumeTrue(IoUring.isAvailable());
}
@Test
public void testRemoteAddressIpv4() throws Exception {
testRemoteAddress(NetUtil.LOCALHOST4, NetUtil.LOCALHOST4);
}
@Test
public void testRemoteAddressIpv6() throws Exception {
testRemoteAddress(NetUtil.LOCALHOST6, NetUtil.LOCALHOST6);
}
@Test
public void testRemoteAddressIpv4AndServerAutoDetect() throws Exception {
testRemoteAddress(null, NetUtil.LOCALHOST4);
}
@Test
public void testRemoteAddressIpv6ServerAutoDetect() throws Exception {
testRemoteAddress(null, NetUtil.LOCALHOST6);
}
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();
}
}
}
Source
Frequently Asked Questions
What is the IoUringRemoteIpTest class?
IoUringRemoteIpTest is a class in the netty codebase, defined in transport-native-io_uring/src/test/java/io/netty/channel/uring/IoUringRemoteIpTest.java.
Where is IoUringRemoteIpTest defined?
IoUringRemoteIpTest is defined in transport-native-io_uring/src/test/java/io/netty/channel/uring/IoUringRemoteIpTest.java at line 40.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free