Home / Function/ testSimpleEcho0() — netty Function Reference

testSimpleEcho0() — netty Function Reference

Architecture documentation for the testSimpleEcho0() function in SocketEchoTest.java from the netty codebase.

Function java Buffer Telemetry calls 2 called by 7

Entity Profile

Dependency Diagram

graph TD
  dff7703c_2c14_b3fa_56b1_2ca87c60f4fe["testSimpleEcho0()"]
  baace803_1db9_4f73_c5e1_915131f09bda["SocketEchoTest"]
  dff7703c_2c14_b3fa_56b1_2ca87c60f4fe -->|defined in| baace803_1db9_4f73_c5e1_915131f09bda
  60bad4d4_1d6a_4ede_279e_36912a59e59c["testSimpleEcho()"]
  60bad4d4_1d6a_4ede_279e_36912a59e59c -->|calls| dff7703c_2c14_b3fa_56b1_2ca87c60f4fe
  6ae3df78_c535_6786_cdeb_ce17fe95e974["testSimpleEchoNotAutoRead()"]
  6ae3df78_c535_6786_cdeb_ce17fe95e974 -->|calls| dff7703c_2c14_b3fa_56b1_2ca87c60f4fe
  3b653a8c_db18_0e9d_ae38_f7eb220a1b30["testSimpleEchoWithAdditionalExecutor()"]
  3b653a8c_db18_0e9d_ae38_f7eb220a1b30 -->|calls| dff7703c_2c14_b3fa_56b1_2ca87c60f4fe
  20f6b432_3022_f214_ad88_04a1f170dec2["testSimpleEchoWithAdditionalExecutorNotAutoRead()"]
  20f6b432_3022_f214_ad88_04a1f170dec2 -->|calls| dff7703c_2c14_b3fa_56b1_2ca87c60f4fe
  5d836a97_2749_1f1c_a661_ed558f01fc9c["testSimpleEchoWithVoidPromise()"]
  5d836a97_2749_1f1c_a661_ed558f01fc9c -->|calls| dff7703c_2c14_b3fa_56b1_2ca87c60f4fe
  5d0e12c3_26c7_3c99_001c_dbca00868806["testSimpleEchoWithVoidPromiseNotAutoRead()"]
  5d0e12c3_26c7_3c99_001c_dbca00868806 -->|calls| dff7703c_2c14_b3fa_56b1_2ca87c60f4fe
  6a974f1e_1d86_efff_c587_1b857f7040ab["testSimpleEchoWithAdditionalExecutorAndVoidPromise()"]
  6a974f1e_1d86_efff_c587_1b857f7040ab -->|calls| dff7703c_2c14_b3fa_56b1_2ca87c60f4fe
  f00838f1_bd95_3f2f_039a_8da620627a51["EchoHandler()"]
  dff7703c_2c14_b3fa_56b1_2ca87c60f4fe -->|calls| f00838f1_bd95_3f2f_039a_8da620627a51
  9cef9c21_6ba3_7d89_c1a2_b28bf813f329["exceptionCaught()"]
  dff7703c_2c14_b3fa_56b1_2ca87c60f4fe -->|calls| 9cef9c21_6ba3_7d89_c1a2_b28bf813f329
  style dff7703c_2c14_b3fa_56b1_2ca87c60f4fe fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java lines 167–252

    private static void testSimpleEcho0(
            ServerBootstrap sb, Bootstrap cb, boolean additionalExecutor, boolean voidPromise, boolean autoRead)
            throws Throwable {

        final EchoHandler sh = new EchoHandler(autoRead);
        final EchoHandler ch = new EchoHandler(autoRead);

        if (additionalExecutor) {
            sb.childHandler(new ChannelInitializer<Channel>() {
                @Override
                protected void initChannel(Channel c) throws Exception {
                    c.pipeline().addLast(group, sh);
                }
            });
            cb.handler(new ChannelInitializer<Channel>() {
                @Override
                protected void initChannel(Channel c) throws Exception {
                    c.pipeline().addLast(group, ch);
                }
            });
        } else {
            sb.childHandler(sh);
            sb.handler(new ChannelInboundHandlerAdapter() {
                @Override
                public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
                    cause.printStackTrace();
                }
            });
            cb.handler(ch);
        }
        sb.childOption(ChannelOption.AUTO_READ, autoRead);
        cb.option(ChannelOption.AUTO_READ, autoRead);

        Channel sc = sb.bind().sync().channel();
        Channel cc = cb.connect(sc.localAddress()).sync().channel();

        for (int i = 0; i < data.length;) {
            int length = Math.min(random.nextInt(1024 * 64), data.length - i);
            ByteBuf buf = randomBufferType(cc.alloc(), data, i, length);
            if (voidPromise) {
                assertEquals(cc.voidPromise(), cc.writeAndFlush(buf, cc.voidPromise()));
            } else {
                assertNotEquals(cc.voidPromise(), cc.writeAndFlush(buf));
            }
            i += length;
        }

        while (ch.counter < data.length) {
            if (sh.exception.get() != null) {
                break;
            }
            if (ch.exception.get() != null) {
                break;
            }

            Thread.sleep(50);
        }

        while (sh.counter < data.length) {
            if (sh.exception.get() != null) {
                break;
            }
            if (ch.exception.get() != null) {
                break;
            }

            Thread.sleep(50);
        }

        sh.channel.close().sync();
        ch.channel.close().sync();
        sc.close().sync();

        if (sh.exception.get() != null && !(sh.exception.get() instanceof IOException)) {
            throw sh.exception.get();
        }
        if (ch.exception.get() != null && !(ch.exception.get() instanceof IOException)) {
            throw ch.exception.get();
        }
        if (sh.exception.get() != null) {
            throw sh.exception.get();

Domain

Subdomains

Frequently Asked Questions

What does testSimpleEcho0() do?
testSimpleEcho0() is a function in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java.
Where is testSimpleEcho0() defined?
testSimpleEcho0() is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java at line 167.
What does testSimpleEcho0() call?
testSimpleEcho0() calls 2 function(s): EchoHandler, exceptionCaught.
What calls testSimpleEcho0()?
testSimpleEcho0() is called by 7 function(s): testSimpleEcho, testSimpleEchoNotAutoRead, testSimpleEchoWithAdditionalExecutor, testSimpleEchoWithAdditionalExecutorAndVoidPromise, testSimpleEchoWithAdditionalExecutorNotAutoRead, testSimpleEchoWithVoidPromise, testSimpleEchoWithVoidPromiseNotAutoRead.

Analyze Your Own Codebase

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

Try Supermodel Free