Home / Function/ testReregisterOnChannelHandlerContext() — netty Function Reference

testReregisterOnChannelHandlerContext() — netty Function Reference

Architecture documentation for the testReregisterOnChannelHandlerContext() function in AbstractEventLoopTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  a9154bc0_2e31_08b0_6b9a_230dfe452c5a["testReregisterOnChannelHandlerContext()"]
  3af4ae7a_14bb_5400_5cb6_2dab6e677f86["AbstractEventLoopTest"]
  a9154bc0_2e31_08b0_6b9a_230dfe452c5a -->|defined in| 3af4ae7a_14bb_5400_5cb6_2dab6e677f86
  07133110_1a0d_23e0_c935_1c3ffb531c17["ReRegisterHandler()"]
  a9154bc0_2e31_08b0_6b9a_230dfe452c5a -->|calls| 07133110_1a0d_23e0_c935_1c3ffb531c17
  ad9b962d_d7d4_34f1_3b1e_3c74ab939d1b["newChannel()"]
  a9154bc0_2e31_08b0_6b9a_230dfe452c5a -->|calls| ad9b962d_d7d4_34f1_3b1e_3c74ab939d1b
  28f4a349_e732_db11_a40a_21f89f5ee272["newSocketChannel()"]
  a9154bc0_2e31_08b0_6b9a_230dfe452c5a -->|calls| 28f4a349_e732_db11_a40a_21f89f5ee272
  43a67bbf_0f1e_6cd2_0e3d_02e9aa298c9d["exceptionCaught()"]
  a9154bc0_2e31_08b0_6b9a_230dfe452c5a -->|calls| 43a67bbf_0f1e_6cd2_0e3d_02e9aa298c9d
  fd4cb239_0079_4349_2f0a_6fdb29ae051d["channelRead()"]
  a9154bc0_2e31_08b0_6b9a_230dfe452c5a -->|calls| fd4cb239_0079_4349_2f0a_6fdb29ae051d
  style a9154bc0_2e31_08b0_6b9a_230dfe452c5a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/AbstractEventLoopTest.java lines 78–135

    @ParameterizedTest
    @EnumSource(DeregisterMethod.class)
    void testReregisterOnChannelHandlerContext(DeregisterMethod method) throws Exception {
        EventLoopGroup group = newEventLoopGroup();
        AtomicReference<Throwable> throwable = new AtomicReference<>();
        try {
            ServerBootstrap b = new ServerBootstrap();
            ReRegisterHandler reRegisterHandler = new ReRegisterHandler(group, method, throwable);
            b.group(group)
                    .channel(newChannel())
                    .childHandler(new ChannelInitializer<SocketChannel>() {
                        @Override
                        public void initChannel(SocketChannel ch) {
                            ChannelPipeline p = ch.pipeline();
                            p.addLast("logging", new LoggingHandler());
                            p.addLast(reRegisterHandler);
                        }
                    });

            ChannelFuture f = b.bind(0).sync();

            Channel client = new Bootstrap()
                    .group(group)
                    .channel(newSocketChannel())
                    .handler(new ChannelInboundHandlerAdapter() {
                        @Override
                        public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
                            ReferenceCountUtil.release(msg);
                        }

                        @Override
                        public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
                            super.channelReadComplete(ctx);
                            ctx.close();
                        }

                        @Override
                        public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
                            throwable.set(cause);
                            super.exceptionCaught(ctx, cause);
                            ctx.close();
                        }
                    })
                    .connect(f.channel().localAddress())
                    .sync()
                    .channel();
            client.closeFuture().addListener(ignore -> f.channel().close());
            client.writeAndFlush(Unpooled.copiedBuffer("hello", StandardCharsets.US_ASCII));

            f.channel().closeFuture().sync();
            Throwable caughtThrowable = throwable.get();
            if (caughtThrowable != null) {
                fail(caughtThrowable);
            }
        } finally {
            group.shutdownGracefully();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testReregisterOnChannelHandlerContext() do?
testReregisterOnChannelHandlerContext() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/AbstractEventLoopTest.java.
Where is testReregisterOnChannelHandlerContext() defined?
testReregisterOnChannelHandlerContext() is defined in transport/src/test/java/io/netty/channel/AbstractEventLoopTest.java at line 78.
What does testReregisterOnChannelHandlerContext() call?
testReregisterOnChannelHandlerContext() calls 5 function(s): ReRegisterHandler, channelRead, exceptionCaught, newChannel, newSocketChannel.

Analyze Your Own Codebase

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

Try Supermodel Free