Home / Function/ testSimpleSend0() — netty Function Reference

testSimpleSend0() — netty Function Reference

Architecture documentation for the testSimpleSend0() function in DatagramUnicastTest.java from the netty codebase.

Function java Buffer Search calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  955359d9_42c9_1060_17ef_af523c9e5229["testSimpleSend0()"]
  fe4d45b3_9e9e_2ee9_7d60_26b49241d521["DatagramUnicastTest"]
  955359d9_42c9_1060_17ef_af523c9e5229 -->|defined in| fe4d45b3_9e9e_2ee9_7d60_26b49241d521
  1d29f357_d8d7_aeac_be4e_38529bf16434["testSimpleSend()"]
  1d29f357_d8d7_aeac_be4e_38529bf16434 -->|calls| 955359d9_42c9_1060_17ef_af523c9e5229
  2d23de82_a483_8ed0_72eb_e0bb5301cb96["closeChannel()"]
  955359d9_42c9_1060_17ef_af523c9e5229 -->|calls| 2d23de82_a483_8ed0_72eb_e0bb5301cb96
  style 955359d9_42c9_1060_17ef_af523c9e5229 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramUnicastTest.java lines 305–361

    @SuppressWarnings("deprecation")
    private void testSimpleSend0(Bootstrap sb, Bootstrap cb, ByteBuf buf, boolean bindClient,
                                final byte[] bytes, int count, WrapType wrapType)
            throws Throwable {
        Channel sc = null;
        Channel cc = null;

        try {
            cb.handler(new SimpleChannelInboundHandler<Object>() {
                @Override
                public void channelRead0(ChannelHandlerContext ctx, Object msgs) {
                    // Nothing will be sent.
                }
            });

            final SocketAddress sender;
            if (bindClient) {
                cc = cb.bind(newSocketAddress()).sync().channel();
                sender = cc.localAddress();
            } else {
                cb.option(ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION, true);
                cc = cb.register().sync().channel();
                sender = null;
            }

            final CountDownLatch latch = new CountDownLatch(count);
            AtomicReference<Throwable> errorRef = new AtomicReference<Throwable>();
            sc = setupServerChannel(sb, bytes, sender, latch, errorRef, false);

            SocketAddress localAddr = sc.localAddress();
            SocketAddress addr = localAddr instanceof InetSocketAddress ?
                    sendToAddress((InetSocketAddress) sc.localAddress()) : localAddr;
            List<ChannelFuture> futures = new ArrayList<ChannelFuture>(count);
            for (int i = 0; i < count; i++) {
                futures.add(write(cc, buf, addr, wrapType));
            }
            // release as we used buf.retain() before
            cc.flush();

            for (ChannelFuture future: futures) {
                future.sync();
            }
            if (!latch.await(10, TimeUnit.SECONDS)) {
                Throwable error = errorRef.get();
                if (error != null) {
                    throw error;
                }
                fail();
            }
        } finally {
            // release as we used buf.retain() before
            buf.release();

            closeChannel(cc);
            closeChannel(sc);
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does testSimpleSend0() do?
testSimpleSend0() is a function in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramUnicastTest.java.
Where is testSimpleSend0() defined?
testSimpleSend0() is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramUnicastTest.java at line 305.
What does testSimpleSend0() call?
testSimpleSend0() calls 1 function(s): closeChannel.
What calls testSimpleSend0()?
testSimpleSend0() is called by 1 function(s): testSimpleSend.

Analyze Your Own Codebase

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

Try Supermodel Free