Home / Function/ embeddedTcpClient() — netty Function Reference

embeddedTcpClient() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  07a73853_84f6_e5d8_e296_bfc3e041abe7["embeddedTcpClient()"]
  e9f4993c_4935_9405_4fab_0bbc9030a673["PcapWriteHandlerTest"]
  07a73853_84f6_e5d8_e296_bfc3e041abe7 -->|defined in| e9f4993c_4935_9405_4fab_0bbc9030a673
  201e7e9e_c23c_b328_ecb1_117026fc1c03["InetSocketAddress()"]
  07a73853_84f6_e5d8_e296_bfc3e041abe7 -->|calls| 201e7e9e_c23c_b328_ecb1_117026fc1c03
  a21dcafa_3fd5_25fa_9ab3_64ba75a8e86a["verifyTcpHandshakeCapture()"]
  07a73853_84f6_e5d8_e296_bfc3e041abe7 -->|calls| a21dcafa_3fd5_25fa_9ab3_64ba75a8e86a
  d3cfaa8b_8ac2_24f3_97d5_6f3a794d3ad8["verifyTcpCapture()"]
  07a73853_84f6_e5d8_e296_bfc3e041abe7 -->|calls| d3cfaa8b_8ac2_24f3_97d5_6f3a794d3ad8
  48f0964c_1c25_e316_603f_d8c514e3fbc2["verifyTcpCloseCapture()"]
  07a73853_84f6_e5d8_e296_bfc3e041abe7 -->|calls| 48f0964c_1c25_e316_603f_d8c514e3fbc2
  style 07a73853_84f6_e5d8_e296_bfc3e041abe7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/pcap/PcapWriteHandlerTest.java lines 598–647

    @Test
    public void embeddedTcpClient() {
        final ByteBuf pcapBuffer = Unpooled.buffer();
        //Differing size payloads so that sequence numbers and ack numbers are different
        final ByteBuf readPayload = Unpooled.wrappedBuffer("Read".getBytes());
        final ByteBuf writePayload = Unpooled.wrappedBuffer("Write".getBytes());

        try {
            InetSocketAddress serverAddr = new InetSocketAddress("1.1.1.1", 1234);
            InetSocketAddress clientAddr = new InetSocketAddress("2.2.2.2", 3456);

            EmbeddedChannel embeddedChannel = new EmbeddedChannel(
                    PcapWriteHandler.builder()
                            .forceTcpChannel(serverAddr, clientAddr, false)
                            .build(new ByteBufOutputStream(pcapBuffer))
            );

            assertTrue(embeddedChannel.writeInbound(readPayload.retainedDuplicate()));
            ByteBuf read = embeddedChannel.readInbound();
            assertEquals(readPayload, read);
            read.release();

            assertTrue(embeddedChannel.writeOutbound(writePayload.retainedDuplicate()));
            read = embeddedChannel.readOutbound();
            assertEquals(writePayload, read);
            read.release();

            assertFalse(embeddedChannel.finishAndReleaseAll());

            // Verify the capture data
            verifyTcpHandshakeCapture(true, pcapBuffer, serverAddr, clientAddr);

            //Verify client read
            verifyTcpCapture(pcapBuffer, readPayload,
                    clientAddr, serverAddr,
                    1, 1);

            //Verify client write
            verifyTcpCapture(pcapBuffer, writePayload,
                    serverAddr, clientAddr,
                    1, 5);

            verifyTcpCloseCapture(pcapBuffer, serverAddr, clientAddr,
                    6, 5); //Client has received 4 bytes and sent 5 bytes
        } finally {
            pcapBuffer.release();
            readPayload.release();
            writePayload.release();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does embeddedTcpClient() do?
embeddedTcpClient() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/pcap/PcapWriteHandlerTest.java.
Where is embeddedTcpClient() defined?
embeddedTcpClient() is defined in handler/src/test/java/io/netty/handler/pcap/PcapWriteHandlerTest.java at line 598.
What does embeddedTcpClient() call?
embeddedTcpClient() calls 4 function(s): InetSocketAddress, verifyTcpCapture, verifyTcpCloseCapture, verifyTcpHandshakeCapture.

Analyze Your Own Codebase

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

Try Supermodel Free