Home / Function/ serverCloseWithoutClientReadIsDetected0() — netty Function Reference

serverCloseWithoutClientReadIsDetected0() — netty Function Reference

Architecture documentation for the serverCloseWithoutClientReadIsDetected0() function in DetectPeerCloseWithoutReadTest.java from the netty codebase.

Function java Buffer Search calls 3 called by 2

Entity Profile

Dependency Diagram

graph TD
  6b17939a_ac76_b01f_2ca8_f0e6e583698c["serverCloseWithoutClientReadIsDetected0()"]
  2f5040d4_a100_f0df_6a2f_a91790d5e155["DetectPeerCloseWithoutReadTest"]
  6b17939a_ac76_b01f_2ca8_f0e6e583698c -->|defined in| 2f5040d4_a100_f0df_6a2f_a91790d5e155
  bf84d5c4_d178_0b0d_5621_1af2b348d292["serverCloseWithoutClientReadIsDetectedNoExtraReadRequested()"]
  bf84d5c4_d178_0b0d_5621_1af2b348d292 -->|calls| 6b17939a_ac76_b01f_2ca8_f0e6e583698c
  861a78b7_1d01_1ba4_7271_f6578641b64f["serverCloseWithoutClientReadIsDetectedExtraReadRequested()"]
  861a78b7_1d01_1ba4_7271_f6578641b64f -->|calls| 6b17939a_ac76_b01f_2ca8_f0e6e583698c
  ed700b6e_0993_6dc8_45c9_2a4304673802["serverChannel()"]
  6b17939a_ac76_b01f_2ca8_f0e6e583698c -->|calls| ed700b6e_0993_6dc8_45c9_2a4304673802
  0b55ef73_d7cd_bc3e_deae_975707a22f28["clientChannel()"]
  6b17939a_ac76_b01f_2ca8_f0e6e583698c -->|calls| 0b55ef73_d7cd_bc3e_deae_975707a22f28
  7170367b_e17b_7820_cc1b_96844cf96015["TestHandler()"]
  6b17939a_ac76_b01f_2ca8_f0e6e583698c -->|calls| 7170367b_e17b_7820_cc1b_96844cf96015
  style 6b17939a_ac76_b01f_2ca8_f0e6e583698c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport-native-unix-common-tests/src/main/java/io/netty/channel/unix/tests/DetectPeerCloseWithoutReadTest.java lines 122–185

    private void serverCloseWithoutClientReadIsDetected0(final boolean extraReadRequested) throws InterruptedException {
        EventLoopGroup serverGroup = null;
        EventLoopGroup clientGroup = null;
        Channel serverChannel = null;
        Channel clientChannel = null;
        try {
            final CountDownLatch latch = new CountDownLatch(1);
            final AtomicInteger bytesRead = new AtomicInteger();
            final int expectedBytes = 100;
            serverGroup = newGroup();
            clientGroup = newGroup();
            ServerBootstrap sb = new ServerBootstrap();
            sb.group(serverGroup);
            sb.channel(serverChannel());
            sb.childHandler(new ChannelInitializer<Channel>() {
                @Override
                protected void initChannel(Channel ch) {
                    ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
                        @Override
                        public void channelActive(ChannelHandlerContext ctx) {
                            ByteBuf buf = ctx.alloc().buffer(expectedBytes);
                            buf.writerIndex(buf.writerIndex() + expectedBytes);
                            ctx.writeAndFlush(buf).addListener(ChannelFutureListener.CLOSE);
                            ctx.fireChannelActive();
                        }
                    });
                }
            });

            serverChannel = sb.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();

            Bootstrap cb = new Bootstrap();
            cb.group(serverGroup);
            cb.channel(clientChannel());
            // Ensure we read only one message per read() call and that we need multiple read()
            // calls to consume everything.
            cb.option(ChannelOption.AUTO_READ, false);
            cb.option(ChannelOption.MAX_MESSAGES_PER_READ, 1);
            cb.option(ChannelOption.RECVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(expectedBytes / 10));
            cb.handler(new ChannelInitializer<Channel>() {
                @Override
                protected void initChannel(Channel ch) throws Exception {
                    ch.pipeline().addLast(new TestHandler(bytesRead, extraReadRequested, latch));
                }
            });
            clientChannel = cb.connect(serverChannel.localAddress()).syncUninterruptibly().channel();

            latch.await();
            assertEquals(expectedBytes, bytesRead.get());
        } finally {
            if (serverChannel != null) {
                serverChannel.close().syncUninterruptibly();
            }
            if (clientChannel != null) {
                clientChannel.close().syncUninterruptibly();
            }
            if (serverGroup != null) {
                serverGroup.shutdownGracefully();
            }
            if (clientGroup != null) {
                clientGroup.shutdownGracefully();
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does serverCloseWithoutClientReadIsDetected0() do?
serverCloseWithoutClientReadIsDetected0() is a function in the netty codebase, defined in transport-native-unix-common-tests/src/main/java/io/netty/channel/unix/tests/DetectPeerCloseWithoutReadTest.java.
Where is serverCloseWithoutClientReadIsDetected0() defined?
serverCloseWithoutClientReadIsDetected0() is defined in transport-native-unix-common-tests/src/main/java/io/netty/channel/unix/tests/DetectPeerCloseWithoutReadTest.java at line 122.
What does serverCloseWithoutClientReadIsDetected0() call?
serverCloseWithoutClientReadIsDetected0() calls 3 function(s): TestHandler, clientChannel, serverChannel.
What calls serverCloseWithoutClientReadIsDetected0()?
serverCloseWithoutClientReadIsDetected0() is called by 2 function(s): serverCloseWithoutClientReadIsDetectedExtraReadRequested, serverCloseWithoutClientReadIsDetectedNoExtraReadRequested.

Analyze Your Own Codebase

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

Try Supermodel Free