Home / Class/ SctpEchoTest Class — netty Architecture

SctpEchoTest Class — netty Architecture

Architecture documentation for the SctpEchoTest class in SctpEchoTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  2177ba03_7d58_bde9_3ea2_00c941c71319["SctpEchoTest"]
  b6ef1bf0_ab1c_3df6_2c8c_1dd85440f2b6["SctpEchoTest.java"]
  2177ba03_7d58_bde9_3ea2_00c941c71319 -->|defined in| b6ef1bf0_ab1c_3df6_2c8c_1dd85440f2b6
  54516e67_c04d_01c0_f7f4_6f88ac797f12["testSimpleEcho()"]
  2177ba03_7d58_bde9_3ea2_00c941c71319 -->|method| 54516e67_c04d_01c0_f7f4_6f88ac797f12
  9881ff4d_6c83_3234_985d_aabd72f0d7a3["testSimpleEchoUnordered()"]
  2177ba03_7d58_bde9_3ea2_00c941c71319 -->|method| 9881ff4d_6c83_3234_985d_aabd72f0d7a3
  ac234909_bb9d_4cc1_12c3_230310f87b1a["testSimpleEcho0()"]
  2177ba03_7d58_bde9_3ea2_00c941c71319 -->|method| ac234909_bb9d_4cc1_12c3_230310f87b1a

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/sctp/SctpEchoTest.java lines 41–191

public class SctpEchoTest extends AbstractSctpTest {

    private static final Random random = new Random();
    static final byte[] data = new byte[4096]; //could not test ultra jumbo frames

    static {
        random.nextBytes(data);
    }

    @Test
    public void testSimpleEcho(TestInfo testInfo) throws Throwable {
        assumeTrue(TestUtils.isSctpSupported());
        run(testInfo, new Runner<ServerBootstrap, Bootstrap>() {
            @Override
            public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
                testSimpleEcho(serverBootstrap, bootstrap);
            }
        });
    }

    public void testSimpleEcho(ServerBootstrap sb, Bootstrap cb) throws Throwable {
        testSimpleEcho0(sb, cb, false);
    }

    @Test
    public void testSimpleEchoUnordered(TestInfo testInfo) throws Throwable {
        assumeTrue(TestUtils.isSctpSupported());
        run(testInfo, new Runner<ServerBootstrap, Bootstrap>() {
            @Override
            public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
                testSimpleEchoUnordered(serverBootstrap, bootstrap);
            }
        });
    }

    public void testSimpleEchoUnordered(ServerBootstrap sb, Bootstrap cb) throws Throwable {
        testSimpleEcho0(sb, cb, true);
    }

    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;
            }

Frequently Asked Questions

What is the SctpEchoTest class?
SctpEchoTest is a class in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/sctp/SctpEchoTest.java.
Where is SctpEchoTest defined?
SctpEchoTest is defined in testsuite/src/main/java/io/netty/testsuite/transport/sctp/SctpEchoTest.java at line 41.

Analyze Your Own Codebase

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

Try Supermodel Free