Home / Class/ KQueueSocketChannelConfigTest Class — netty Architecture

KQueueSocketChannelConfigTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  31852228_660c_9dba_2029_e09ec06ff61a["KQueueSocketChannelConfigTest"]
  958becdd_1383_8fff_f550_76a36d48e01e["KQueueSocketChannelConfigTest.java"]
  31852228_660c_9dba_2029_e09ec06ff61a -->|defined in| 958becdd_1383_8fff_f550_76a36d48e01e
  54a580e2_4c6f_1070_d2b5_ace2221b1686["beforeClass()"]
  31852228_660c_9dba_2029_e09ec06ff61a -->|method| 54a580e2_4c6f_1070_d2b5_ace2221b1686
  2462e289_1763_fdac_752c_615324f78b10["afterClass()"]
  31852228_660c_9dba_2029_e09ec06ff61a -->|method| 2462e289_1763_fdac_752c_615324f78b10
  6793a69c_8f4b_4c9b_0ee9_0179a79bab6a["setup()"]
  31852228_660c_9dba_2029_e09ec06ff61a -->|method| 6793a69c_8f4b_4c9b_0ee9_0179a79bab6a
  e2351cf5_12ed_c0ce_74d3_25b030cb871e["teardown()"]
  31852228_660c_9dba_2029_e09ec06ff61a -->|method| e2351cf5_12ed_c0ce_74d3_25b030cb871e
  0e7eab13_9ac8_a4c5_d583_5bcd963373fa["testRandomSndLowAt()"]
  31852228_660c_9dba_2029_e09ec06ff61a -->|method| 0e7eab13_9ac8_a4c5_d583_5bcd963373fa
  c92555bc_372c_3d1d_d5d8_eeb6a84d4105["testInvalidHighSndLowAt()"]
  31852228_660c_9dba_2029_e09ec06ff61a -->|method| c92555bc_372c_3d1d_d5d8_eeb6a84d4105
  ae93de45_7e86_0c38_2f47_678067e3ec60["testTcpNoPush()"]
  31852228_660c_9dba_2029_e09ec06ff61a -->|method| ae93de45_7e86_0c38_2f47_678067e3ec60
  30bc7bc0_37ca_a9a9_a12d_7b24cad85bbc["testSetOptionWhenClosed()"]
  31852228_660c_9dba_2029_e09ec06ff61a -->|method| 30bc7bc0_37ca_a9a9_a12d_7b24cad85bbc
  bdf966c8_2059_53ec_f93e_cf9ca98526b8["testGetOptionWhenClosed()"]
  31852228_660c_9dba_2029_e09ec06ff61a -->|method| bdf966c8_2059_53ec_f93e_cf9ca98526b8

Relationship Graph

Source Code

transport-native-kqueue/src/test/java/io/netty/channel/kqueue/KQueueSocketChannelConfigTest.java lines 41–126

public class KQueueSocketChannelConfigTest {

    private static EventLoopGroup group;
    private static KQueueSocketChannel ch;
    private static Random rand;

    @BeforeAll
    public static void beforeClass() {
        rand = new Random();
        group = new MultiThreadIoEventLoopGroup(1, KQueueIoHandler.newFactory());
    }

    @AfterAll
    public static void afterClass() {
        group.shutdownGracefully();
    }

    @BeforeEach
    public void setup() {
        Bootstrap bootstrap = new Bootstrap();
        ch = (KQueueSocketChannel) bootstrap.group(group)
                .channel(KQueueSocketChannel.class)
                .handler(new ChannelInboundHandlerAdapter())
                .bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
    }

    @AfterEach
    public void teardown() {
        ch.close().syncUninterruptibly();
    }

    @Test
    public void testRandomSndLowAt() {
        final int expected = Math.min(BSD_SND_LOW_AT_MAX, Math.abs(rand.nextInt()));
        final int actual;
        try {
            ch.config().setSndLowAt(expected);
            actual = ch.config().getSndLowAt();
        } catch (RuntimeException e) {
            throw new TestAbortedException("assumeNoException", e);
        }
        assertEquals(expected, actual);
    }

    @Test
    public void testInvalidHighSndLowAt() {
        try {
            ch.config().setSndLowAt(Integer.MIN_VALUE);
        } catch (ChannelException e) {
            return;
        } catch (RuntimeException e) {
            throw new TestAbortedException("assumeNoException", e);
        }
        fail();
    }

    @Test
    public void testTcpNoPush() {
        ch.config().setTcpNoPush(false);
        assertFalse(ch.config().isTcpNoPush());
        ch.config().setTcpNoPush(true);
        assertTrue(ch.config().isTcpNoPush());
    }

    @Test
    public void testSetOptionWhenClosed() {
        ch.close().syncUninterruptibly();
        try {
            ch.config().setSoLinger(0);
            fail();
        } catch (ChannelException e) {
            assertTrue(e.getCause() instanceof ClosedChannelException);
        }
    }

    @Test
    public void testGetOptionWhenClosed() {
        ch.close().syncUninterruptibly();
        try {
        ch.config().getSoLinger();
            fail();

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free