Home / Function/ optionsAndAttributesMustBeAvailableOnChildChannelInit() — netty Function Reference

optionsAndAttributesMustBeAvailableOnChildChannelInit() — netty Function Reference

Architecture documentation for the optionsAndAttributesMustBeAvailableOnChildChannelInit() function in ServerBootstrapTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  f82d1300_2427_7857_c406_c8772495c3a3["optionsAndAttributesMustBeAvailableOnChildChannelInit()"]
  ea70f915_ade9_644f_5c4a_f1b52d559227["ServerBootstrapTest"]
  f82d1300_2427_7857_c406_c8772495c3a3 -->|defined in| ea70f915_ade9_644f_5c4a_f1b52d559227
  style f82d1300_2427_7857_c406_c8772495c3a3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/bootstrap/ServerBootstrapTest.java lines 187–218

    @Test
    public void optionsAndAttributesMustBeAvailableOnChildChannelInit() throws InterruptedException {
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, LocalIoHandler.newFactory());
        LocalAddress addr = new LocalAddress(UUID.randomUUID().toString());
        final AttributeKey<String> key = AttributeKey.valueOf(UUID.randomUUID().toString());
        final AtomicBoolean requestServed = new AtomicBoolean();
        ServerBootstrap sb = new ServerBootstrap()
                .group(group)
                .channel(LocalServerChannel.class)
                .childOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, 4242)
                .childAttr(key, "value")
                .childHandler(new ChannelInitializer<LocalChannel>() {
                    @Override
                    protected void initChannel(LocalChannel ch) throws Exception {
                        Integer option = ch.config().getOption(ChannelOption.CONNECT_TIMEOUT_MILLIS);
                        assertEquals(4242, (int) option);
                        assertEquals("value", ch.attr(key).get());
                        requestServed.set(true);
                    }
                });
        Channel serverChannel = sb.bind(addr).syncUninterruptibly().channel();

        Bootstrap cb = new Bootstrap();
        cb.group(group)
                .channel(LocalChannel.class)
                .handler(new ChannelInboundHandlerAdapter());
        Channel clientChannel = cb.connect(addr).syncUninterruptibly().channel();
        serverChannel.close().syncUninterruptibly();
        clientChannel.close().syncUninterruptibly();
        group.shutdownGracefully();
        assertTrue(requestServed.get());
    }

Domain

Subdomains

Frequently Asked Questions

What does optionsAndAttributesMustBeAvailableOnChildChannelInit() do?
optionsAndAttributesMustBeAvailableOnChildChannelInit() is a function in the netty codebase, defined in transport/src/test/java/io/netty/bootstrap/ServerBootstrapTest.java.
Where is optionsAndAttributesMustBeAvailableOnChildChannelInit() defined?
optionsAndAttributesMustBeAvailableOnChildChannelInit() is defined in transport/src/test/java/io/netty/bootstrap/ServerBootstrapTest.java at line 187.

Analyze Your Own Codebase

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

Try Supermodel Free