Home / Function/ mySetupClientHostnameValidation() — netty Function Reference

mySetupClientHostnameValidation() — netty Function Reference

Architecture documentation for the mySetupClientHostnameValidation() function in NativeTransportTest.java from the netty codebase.

Function java Buffer Search called by 3

Entity Profile

Dependency Diagram

graph TD
  e3cf72c2_5742_f496_2183_5b6382f859d4["mySetupClientHostnameValidation()"]
  cf2ab480_cb38_d68d_b212_10cd6ceaf507["NativeTransportTest"]
  e3cf72c2_5742_f496_2183_5b6382f859d4 -->|defined in| cf2ab480_cb38_d68d_b212_10cd6ceaf507
  9c7dbd49_5204_a879_ce8b_4bb886667e6c["testKQueue()"]
  9c7dbd49_5204_a879_ce8b_4bb886667e6c -->|calls| e3cf72c2_5742_f496_2183_5b6382f859d4
  438f4eeb_17ae_44dd_72aa_a9eddec27dab["testEpoll()"]
  438f4eeb_17ae_44dd_72aa_a9eddec27dab -->|calls| e3cf72c2_5742_f496_2183_5b6382f859d4
  dccb987c_c122_8920_1a97_bec70ab06615["testIoUring()"]
  dccb987c_c122_8920_1a97_bec70ab06615 -->|calls| e3cf72c2_5742_f496_2183_5b6382f859d4
  style e3cf72c2_5742_f496_2183_5b6382f859d4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/NativeTransportTest.java lines 84–152

    private void mySetupClientHostnameValidation(IoHandlerFactory ioHandlerFactory,
                                                 Class<? extends ServerSocketChannel> serverSocketChannelFactory,
                                                 Class<? extends SocketChannel> socketChannelFactory
    ) throws InterruptedException {

        ServerBootstrap sb = new ServerBootstrap();
        Bootstrap cb = new Bootstrap();

        sb.group(new MultiThreadIoEventLoopGroup(ioHandlerFactory));
        sb.channel(serverSocketChannelFactory);
        sb.childHandler(new ChannelInitializer() {
            @Override
            protected void initChannel(Channel ch) throws Exception {
                ChannelPipeline p = ch.pipeline();

                p.addLast(new ChannelInboundHandlerAdapter() {
                    @Override
                    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
                        if (msg instanceof ByteBuf) {
                            ctx.write(msg);
                        } else {
                            super.channelRead(ctx, msg);
                        }
                    }
                    @Override
                    public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
                        ctx.flush();
                    }
                });
            }
        });

        List<String> received = Collections.synchronizedList(new ArrayList<>());

        cb.group(new MultiThreadIoEventLoopGroup(ioHandlerFactory));
        cb.channel(socketChannelFactory);
        cb.handler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) throws Exception {
                ChannelPipeline p = ch.pipeline();
                p.addLast(new ChannelInboundHandlerAdapter() {
                    @Override
                    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
                        if (msg instanceof ByteBuf) {
                            ByteBuf buff = (ByteBuf) msg;
                            try {
                                received.add(buff.toString(StandardCharsets.UTF_8));
                            } finally {
                                buff.release();
                            }
                        }
                    }
                });
            }
        });

        Channel serverChannel = sb.bind(new InetSocketAddress("localhost", 0)).sync().channel();
        final int port = ((InetSocketAddress) serverChannel.localAddress()).getPort();

        ChannelFuture ccf = cb.connect(new InetSocketAddress("localhost", port));
        assertTrue(ccf.awaitUninterruptibly().isSuccess());
        Channel clientChannel = ccf.channel();
        clientChannel.writeAndFlush(Unpooled.copiedBuffer("hello", StandardCharsets.UTF_8)).sync();

        while (received.isEmpty()) {
            Thread.sleep(100);
        }
        assertEquals("hello", received.get(0));
    }

Domain

Subdomains

Frequently Asked Questions

What does mySetupClientHostnameValidation() do?
mySetupClientHostnameValidation() is a function in the netty codebase, defined in testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/NativeTransportTest.java.
Where is mySetupClientHostnameValidation() defined?
mySetupClientHostnameValidation() is defined in testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/NativeTransportTest.java at line 84.
What calls mySetupClientHostnameValidation()?
mySetupClientHostnameValidation() is called by 3 function(s): testEpoll, testIoUring, testKQueue.

Analyze Your Own Codebase

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

Try Supermodel Free