Home / Function/ udpZeroLengthDatagramDiscarded() — netty Function Reference

udpZeroLengthDatagramDiscarded() — netty Function Reference

Architecture documentation for the udpZeroLengthDatagramDiscarded() function in PcapWriteHandlerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e48dd0a4_d1f2_4480_060c_0d21440a7cc5["udpZeroLengthDatagramDiscarded()"]
  e9f4993c_4935_9405_4fab_0bbc9030a673["PcapWriteHandlerTest"]
  e48dd0a4_d1f2_4480_060c_0d21440a7cc5 -->|defined in| e9f4993c_4935_9405_4fab_0bbc9030a673
  201e7e9e_c23c_b328_ecb1_117026fc1c03["InetSocketAddress()"]
  e48dd0a4_d1f2_4480_060c_0d21440a7cc5 -->|calls| 201e7e9e_c23c_b328_ecb1_117026fc1c03
  5c425ce6_e952_d363_e0ef_0934a41b930a["EmbeddedDatagramChannel()"]
  e48dd0a4_d1f2_4480_060c_0d21440a7cc5 -->|calls| 5c425ce6_e952_d363_e0ef_0934a41b930a
  style e48dd0a4_d1f2_4480_060c_0d21440a7cc5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/pcap/PcapWriteHandlerTest.java lines 389–423

    @Test
    public void udpZeroLengthDatagramDiscarded() {
        final ByteBuf pcapBuffer = Unpooled.buffer();
        final ByteBuf payload = Unpooled.buffer();
        InetSocketAddress serverAddr = new InetSocketAddress("1.1.1.1", 1234);
        InetSocketAddress clientAddr = new InetSocketAddress("2.2.2.2", 3456);
        final DatagramPacket outbound = new DatagramPacket(payload.retainedDuplicate(), serverAddr);
        final DatagramPacket inbound = new DatagramPacket(payload.retainedDuplicate(), clientAddr, serverAddr);
        try {
            // We fake a client
            EmbeddedChannel embeddedChannel = new EmbeddedDatagramChannel(clientAddr, serverAddr);
            embeddedChannel.pipeline().addLast(PcapWriteHandler.builder()
                    .build(new ByteBufOutputStream(pcapBuffer)));

            assertTrue(embeddedChannel.writeOutbound(outbound.retainedDuplicate()));
            DatagramPacket read = embeddedChannel.readOutbound();
            assertEquals(outbound.content(), read.content());
            read.release();

            assertTrue(embeddedChannel.writeInbound(inbound.retainedDuplicate()));
            read = embeddedChannel.readInbound();
            assertEquals(inbound.content(), read.content());
            read.release();

            // Verify only the PCAP global header was written. Large UDP payload should be discarded
            assertEquals(24, pcapBuffer.readableBytes());

            assertFalse(embeddedChannel.finishAndReleaseAll());
        } finally {
            pcapBuffer.release();
            payload.release();
            outbound.release();
            inbound.release();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does udpZeroLengthDatagramDiscarded() do?
udpZeroLengthDatagramDiscarded() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/pcap/PcapWriteHandlerTest.java.
Where is udpZeroLengthDatagramDiscarded() defined?
udpZeroLengthDatagramDiscarded() is defined in handler/src/test/java/io/netty/handler/pcap/PcapWriteHandlerTest.java at line 389.
What does udpZeroLengthDatagramDiscarded() call?
udpZeroLengthDatagramDiscarded() calls 2 function(s): EmbeddedDatagramChannel, InetSocketAddress.

Analyze Your Own Codebase

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

Try Supermodel Free