Home / Function/ testConstructWithChannelInitializer() — netty Function Reference

testConstructWithChannelInitializer() — netty Function Reference

Architecture documentation for the testConstructWithChannelInitializer() function in EmbeddedChannelTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  193f4ebc_c392_1e6c_58a2_ac138725441a["testConstructWithChannelInitializer()"]
  300cabef_b042_697f_5623_37ce249f504d["EmbeddedChannelTest"]
  193f4ebc_c392_1e6c_58a2_ac138725441a -->|defined in| 300cabef_b042_697f_5623_37ce249f504d
  style 193f4ebc_c392_1e6c_58a2_ac138725441a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/embedded/EmbeddedChannelTest.java lines 101–126

    @Test
    public void testConstructWithChannelInitializer() {
        final Integer first = 1;
        final Integer second = 2;

        final ChannelHandler handler = new ChannelInboundHandlerAdapter() {
            @Override
            public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
                ctx.fireChannelRead(first);
                ctx.fireChannelRead(second);
            }
        };
        EmbeddedChannel channel = new EmbeddedChannel(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) throws Exception {
                ch.pipeline().addLast(handler);
            }
        });
        ChannelPipeline pipeline = channel.pipeline();
        assertSame(handler, pipeline.firstContext().handler());
        assertTrue(channel.writeInbound(3));
        assertTrue(channel.finish());
        assertSame(first, channel.readInbound());
        assertSame(second, channel.readInbound());
        assertNull(channel.readInbound());
    }

Domain

Subdomains

Frequently Asked Questions

What does testConstructWithChannelInitializer() do?
testConstructWithChannelInitializer() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/embedded/EmbeddedChannelTest.java.
Where is testConstructWithChannelInitializer() defined?
testConstructWithChannelInitializer() is defined in transport/src/test/java/io/netty/channel/embedded/EmbeddedChannelTest.java at line 101.

Analyze Your Own Codebase

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

Try Supermodel Free