Home / Function/ testChannelAcquiredException() — netty Function Reference

testChannelAcquiredException() — netty Function Reference

Architecture documentation for the testChannelAcquiredException() function in SimpleChannelPoolTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  93230eaa_c699_cb6d_4ae2_c0ac1c3a194b["testChannelAcquiredException()"]
  dfb428cc_ecc3_d271_5689_7e428381a986["SimpleChannelPoolTest"]
  93230eaa_c699_cb6d_4ae2_c0ac1c3a194b -->|defined in| dfb428cc_ecc3_d271_5689_7e428381a986
  style 93230eaa_c699_cb6d_4ae2_c0ac1c3a194b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/pool/SimpleChannelPoolTest.java lines 356–399

    @Test
    public void testChannelAcquiredException() throws InterruptedException {
        final LocalAddress addr = new LocalAddress(getLocalAddrId());
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory());

        // Start server
        final ServerBootstrap sb = new ServerBootstrap()
              .group(group)
              .channel(LocalServerChannel.class)
              .childHandler(new ChannelInitializer<LocalChannel>() {
                  @Override
                  protected void initChannel(LocalChannel ch) throws Exception {
                      ch.pipeline().addLast(new ChannelInboundHandlerAdapter());
                  }
              });
        final Channel sc = sb.bind(addr).syncUninterruptibly().channel();

        // Create pool, acquire and return channels
        final Bootstrap bootstrap = new Bootstrap()
              .channel(LocalChannel.class).group(group).remoteAddress(addr);
        final NullPointerException exception = new NullPointerException();
        final SimpleChannelPool pool = new SimpleChannelPool(bootstrap, new ChannelPoolHandler() {
            @Override
            public void channelReleased(Channel ch) {
            }
            @Override
            public void channelAcquired(Channel ch) {
                throw exception;
            }
            @Override
            public void channelCreated(Channel ch) {
            }
        });

        try {
            pool.acquire().sync();
        } catch (NullPointerException e) {
            assertSame(e, exception);
        }

        sc.close().sync();
        pool.close();
        group.shutdownGracefully();
    }

Domain

Subdomains

Frequently Asked Questions

What does testChannelAcquiredException() do?
testChannelAcquiredException() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/pool/SimpleChannelPoolTest.java.
Where is testChannelAcquiredException() defined?
testChannelAcquiredException() is defined in transport/src/test/java/io/netty/channel/pool/SimpleChannelPoolTest.java at line 356.

Analyze Your Own Codebase

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

Try Supermodel Free