Home / Class/ EpollServerSocketChannelConfigTest Class — netty Architecture

EpollServerSocketChannelConfigTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  78d8dc4a_1469_96a9_4370_4db3572c86e8["EpollServerSocketChannelConfigTest"]
  1ec06d7d_e391_0928_3e1e_2eda5e231a36["EpollServerSocketChannelConfigTest.java"]
  78d8dc4a_1469_96a9_4370_4db3572c86e8 -->|defined in| 1ec06d7d_e391_0928_3e1e_2eda5e231a36
  4c73411c_be90_1f24_4ebe_775fa18270c6["before()"]
  78d8dc4a_1469_96a9_4370_4db3572c86e8 -->|method| 4c73411c_be90_1f24_4ebe_775fa18270c6
  90c210a3_b484_1463_ba52_48b7b540cf2f["after()"]
  78d8dc4a_1469_96a9_4370_4db3572c86e8 -->|method| 90c210a3_b484_1463_ba52_48b7b540cf2f
  972a28df_3943_adfe_de4e_b823952746c3["testTcpDeferAccept()"]
  78d8dc4a_1469_96a9_4370_4db3572c86e8 -->|method| 972a28df_3943_adfe_de4e_b823952746c3
  39e6c8c5_7c58_fdf1_e1b4_757e3464a91c["testReusePort()"]
  78d8dc4a_1469_96a9_4370_4db3572c86e8 -->|method| 39e6c8c5_7c58_fdf1_e1b4_757e3464a91c
  fb04d410_c353_224a_3254_5448bac39e57["testFreeBind()"]
  78d8dc4a_1469_96a9_4370_4db3572c86e8 -->|method| fb04d410_c353_224a_3254_5448bac39e57
  27eb4a82_808a_4ea6_5b62_4d94370f073f["getGetOptions()"]
  78d8dc4a_1469_96a9_4370_4db3572c86e8 -->|method| 27eb4a82_808a_4ea6_5b62_4d94370f073f
  f7d62a38_4382_92d8_2965_9cded485d22c["testFastOpen()"]
  78d8dc4a_1469_96a9_4370_4db3572c86e8 -->|method| f7d62a38_4382_92d8_2965_9cded485d22c

Relationship Graph

Source Code

transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollServerSocketChannelConfigTest.java lines 37–104

public class EpollServerSocketChannelConfigTest {

    private static EventLoopGroup group;
    private static EpollServerSocketChannel ch;

    @BeforeAll
    public static void before() {
        group = new MultiThreadIoEventLoopGroup(1,  EpollIoHandler.newFactory());
        ServerBootstrap bootstrap = new ServerBootstrap();
        ch = (EpollServerSocketChannel) bootstrap.group(group)
                .channel(EpollServerSocketChannel.class)
                .childHandler(new ChannelInboundHandlerAdapter())
                .bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
    }

    @AfterAll
    public static void after() {
        try {
            ch.close().syncUninterruptibly();
        } finally {
            group.shutdownGracefully();
        }
    }

    @Test
    public void testTcpDeferAccept() {
        ch.config().setTcpDeferAccept(0);
        assertEquals(0, ch.config().getTcpDeferAccept());
        ch.config().setTcpDeferAccept(10);
        // The returned value may be bigger then what we set.
        // See https://www.spinics.net/lists/netdev/msg117330.html
        assertTrue(10 <= ch.config().getTcpDeferAccept());
    }

    @Test
    public void testReusePort() {
        ch.config().setReusePort(false);
        assertFalse(ch.config().isReusePort());
        ch.config().setReusePort(true);
        assertTrue(ch.config().isReusePort());
    }

    @Test
    public void testFreeBind() {
        ch.config().setFreeBind(false);
        assertFalse(ch.config().isFreeBind());
        ch.config().setFreeBind(true);
        assertTrue(ch.config().isFreeBind());
    }

    @Test
    public void getGetOptions() {
        Map<ChannelOption<?>, Object> map = ch.config().getOptions();
        assertFalse(map.isEmpty());
    }

    @Test
    public void testFastOpen() {
        assertThrows(IllegalArgumentException.class, new Executable() {
            @Override
            public void execute() {
                ch.config().setTcpFastopen(-1);
            }
        });
        ch.config().setTcpFastopen(10);
        assertEquals(10, ch.config().getTcpFastopen());
    }
}

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free