Home / Class/ EpollChannelConfigTest Class — netty Architecture

EpollChannelConfigTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  7543ebba_fcb9_7965_bc72_f8525a811eb2["EpollChannelConfigTest"]
  fb7d7d08_a1e3_4dfa_a426_371c9a7a55ba["EpollChannelConfigTest.java"]
  7543ebba_fcb9_7965_bc72_f8525a811eb2 -->|defined in| fb7d7d08_a1e3_4dfa_a426_371c9a7a55ba
  8427443d_ca1f_5f07_a17c_821ec5978bdb["testOptionGetThrowsChannelException()"]
  7543ebba_fcb9_7965_bc72_f8525a811eb2 -->|method| 8427443d_ca1f_5f07_a17c_821ec5978bdb
  a7439d6b_adf8_de63_c42e_3bd3285e8e7c["testOptionSetThrowsChannelException()"]
  7543ebba_fcb9_7965_bc72_f8525a811eb2 -->|method| a7439d6b_adf8_de63_c42e_3bd3285e8e7c
  e37f479f_b87c_979f_0955_2590ccbeac84["testIntegerOption()"]
  7543ebba_fcb9_7965_bc72_f8525a811eb2 -->|method| e37f479f_b87c_979f_0955_2590ccbeac84
  a60b2860_4cf8_3333_0752_010f5cf93563["testRawOption()"]
  7543ebba_fcb9_7965_bc72_f8525a811eb2 -->|method| a60b2860_4cf8_3333_0752_010f5cf93563

Relationship Graph

Source Code

transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollChannelConfigTest.java lines 32–97

public class EpollChannelConfigTest {

    @Test
    public void testOptionGetThrowsChannelException() throws Exception {
        Epoll.ensureAvailability();
        EpollSocketChannel channel = new EpollSocketChannel();
        channel.config().getSoLinger();
        channel.fd().close();
        try {
            channel.config().getSoLinger();
            fail();
        } catch (ChannelException e) {
            // expected
        }
    }

    @Test
    public void testOptionSetThrowsChannelException() throws Exception {
        Epoll.ensureAvailability();
        EpollSocketChannel channel = new EpollSocketChannel();
        channel.config().setKeepAlive(true);
        channel.fd().close();
        try {
            channel.config().setKeepAlive(true);
            fail();
        } catch (ChannelException e) {
            // expected
        }
    }

    @Test
    public void testIntegerOption() throws Exception {
        Epoll.ensureAvailability();
        EpollSocketChannel channel = new EpollSocketChannel();
        IntegerUnixChannelOption opt = new IntegerUnixChannelOption("INT_OPT", 1, 2);
        Integer zero = 0;
        assertEquals(zero, channel.config().getOption(opt));
        channel.config().setOption(opt, 1);
        assertNotEquals(zero, channel.config().getOption(opt));
        channel.fd().close();
    }

    @Test
    public void testRawOption() throws Exception {
        Epoll.ensureAvailability();
        EpollSocketChannel channel = new EpollSocketChannel();
        // Value for SOL_SOCKET and SO_REUSEADDR
        // See https://github.com/torvalds/linux/blob/v5.17/include/uapi/asm-generic/socket.h
        RawUnixChannelOption opt = new RawUnixChannelOption("RAW_OPT", 1, 2, 4);

        CleanableDirectBuffer disabledCleanable = Buffer.allocateDirectBufferWithNativeOrder(4);
        ByteBuffer disabled = disabledCleanable.buffer();
        disabled.putInt(0).flip();
        assertEquals(disabled, channel.config().getOption(opt));

        CleanableDirectBuffer enabledCleanable = Buffer.allocateDirectBufferWithNativeOrder(4);
        ByteBuffer enabled = enabledCleanable.buffer();
        enabled.putInt(1).flip();

        channel.config().setOption(opt, enabled);
        assertNotEquals(disabled, channel.config().getOption(opt));
        channel.fd().close();
        disabledCleanable.clean();
        enabledCleanable.clean();
    }
}

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free