Home / Function/ testSimpleEcho0() — netty Function Reference

testSimpleEcho0() — netty Function Reference

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

Function java Buffer Search called by 2

Entity Profile

Dependency Diagram

graph TD
  ac234909_bb9d_4cc1_12c3_230310f87b1a["testSimpleEcho0()"]
  2177ba03_7d58_bde9_3ea2_00c941c71319["SctpEchoTest"]
  ac234909_bb9d_4cc1_12c3_230310f87b1a -->|defined in| 2177ba03_7d58_bde9_3ea2_00c941c71319
  54516e67_c04d_01c0_f7f4_6f88ac797f12["testSimpleEcho()"]
  54516e67_c04d_01c0_f7f4_6f88ac797f12 -->|calls| ac234909_bb9d_4cc1_12c3_230310f87b1a
  9881ff4d_6c83_3234_985d_aabd72f0d7a3["testSimpleEchoUnordered()"]
  9881ff4d_6c83_3234_985d_aabd72f0d7a3 -->|calls| ac234909_bb9d_4cc1_12c3_230310f87b1a
  style ac234909_bb9d_4cc1_12c3_230310f87b1a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/sctp/SctpEchoTest.java lines 80–153

    private static void testSimpleEcho0(ServerBootstrap sb, Bootstrap cb, final boolean unordered) throws Throwable {
        final EchoHandler sh = new EchoHandler();
        final EchoHandler ch = new EchoHandler();

        sb.childHandler(new ChannelInitializer<SctpChannel>() {
            @Override
            public void initChannel(SctpChannel c) throws Exception {
                c.pipeline().addLast(
                        new SctpMessageCompletionHandler(),
                        new SctpInboundByteStreamHandler(0, 0),
                        new SctpOutboundByteStreamHandler(0, 0, unordered),
                        sh);
            }
        });
        cb.handler(new ChannelInitializer<SctpChannel>() {
            @Override
            public void initChannel(SctpChannel c) throws Exception {
                c.pipeline().addLast(
                        new SctpMessageCompletionHandler(),
                        new SctpInboundByteStreamHandler(0, 0),
                        new SctpOutboundByteStreamHandler(0, 0, unordered),
                        ch);
            }
        });

        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 msg = randomBufferType(sc.alloc(), data, i, length);
            cc.writeAndFlush(msg);
            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();
        }
        if (ch.exception.get() != null) {
            throw ch.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/sctp/SctpEchoTest.java.
Where is testSimpleEcho0() defined?
testSimpleEcho0() is defined in testsuite/src/main/java/io/netty/testsuite/transport/sctp/SctpEchoTest.java at line 80.
What calls testSimpleEcho0()?
testSimpleEcho0() is called by 2 function(s): testSimpleEcho, testSimpleEchoUnordered.

Analyze Your Own Codebase

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

Try Supermodel Free