Home / Class/ EpollSocketTest Class — netty Architecture

EpollSocketTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  7960ae60_2326_353e_f75e_e3794db8e25d["EpollSocketTest"]
  f8e1e160_4328_c260_6c5e_3e59fa428084["EpollSocketTest.java"]
  7960ae60_2326_353e_f75e_e3794db8e25d -->|defined in| f8e1e160_4328_c260_6c5e_3e59fa428084
  c74901c1_c638_f935_65fa_eedaa2083ddf["loadJNI()"]
  7960ae60_2326_353e_f75e_e3794db8e25d -->|method| c74901c1_c638_f935_65fa_eedaa2083ddf
  20c4dc48_5917_c209_1571_a7ad08a230e2["testTcpCork()"]
  7960ae60_2326_353e_f75e_e3794db8e25d -->|method| 20c4dc48_5917_c209_1571_a7ad08a230e2
  863e8c95_9eaf_aca6_b346_28221d848946["testPeerCreds()"]
  7960ae60_2326_353e_f75e_e3794db8e25d -->|method| 863e8c95_9eaf_aca6_b346_28221d848946
  f8291392_51dd_82b6_9329_b62591173c11["LinuxSocket()"]
  7960ae60_2326_353e_f75e_e3794db8e25d -->|method| f8291392_51dd_82b6_9329_b62591173c11
  ac90501f_009a_9f5a_3c91_80b20ec1be44["level()"]
  7960ae60_2326_353e_f75e_e3794db8e25d -->|method| ac90501f_009a_9f5a_3c91_80b20ec1be44
  9508d462_4679_9784_d726_c022863a494e["optname()"]
  7960ae60_2326_353e_f75e_e3794db8e25d -->|method| 9508d462_4679_9784_d726_c022863a494e

Relationship Graph

Source Code

transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketTest.java lines 31–83

public class EpollSocketTest extends SocketTest<LinuxSocket> {
    @BeforeAll
    public static void loadJNI() {
        Epoll.ensureAvailability();
    }

    @Test
    public void testTcpCork() throws Exception {
        assertFalse(socket.isTcpCork());
        socket.setTcpCork(true);
        assertTrue(socket.isTcpCork());
    }

    @Test
    public void testPeerCreds() throws IOException {
        LinuxSocket s1 = LinuxSocket.newSocketDomain();
        LinuxSocket s2 = LinuxSocket.newSocketDomain();

        try {
            DomainSocketAddress dsa = UnixTestUtils.newDomainSocketAddress();
            s1.bind(dsa);
            s1.listen(1);

            assertTrue(s2.connect(dsa));
            byte [] addr = new byte[64];
            s1.accept(addr);
            PeerCredentials pc = s1.getPeerCredentials();
            assertNotEquals(pc.uid(), -1);
        } finally {
            s1.close();
            s2.close();
        }
    }

    @Override
    protected LinuxSocket newSocket() {
        return LinuxSocket.newSocketStream();
    }

    @Override
    protected int level() {
        // Value for SOL_SOCKET
        // See https://github.com/torvalds/linux/blob/v5.17/include/uapi/asm-generic/socket.h
        return 1;
    }

    @Override
    protected int optname() {
        // Value for SO_REUSEADDR
        // See https://github.com/torvalds/linux/blob/v5.17/include/uapi/asm-generic/socket.h
        return 2;
    }
}

Frequently Asked Questions

What is the EpollSocketTest class?
EpollSocketTest is a class in the netty codebase, defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketTest.java.
Where is EpollSocketTest defined?
EpollSocketTest is defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketTest.java at line 31.

Analyze Your Own Codebase

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

Try Supermodel Free