Home / Class/ EpollSocketChannelConfigTest Class — netty Architecture

EpollSocketChannelConfigTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  cbf3710d_0610_b07a_f224_0edbf3495fdf["EpollSocketChannelConfigTest"]
  2be0b491_f951_6254_be31_31dbbd1c3941["EpollSocketChannelConfigTest.java"]
  cbf3710d_0610_b07a_f224_0edbf3495fdf -->|defined in| 2be0b491_f951_6254_be31_31dbbd1c3941
  63b341d2_f78f_73bc_03f3_1ea5bf415683["beforeClass()"]
  cbf3710d_0610_b07a_f224_0edbf3495fdf -->|method| 63b341d2_f78f_73bc_03f3_1ea5bf415683
  c7709890_df01_2cc2_1f0c_bb13cb8c6a84["afterClass()"]
  cbf3710d_0610_b07a_f224_0edbf3495fdf -->|method| c7709890_df01_2cc2_1f0c_bb13cb8c6a84
  e852d500_b34b_0749_b4ca_bdfcbeb993f0["setup()"]
  cbf3710d_0610_b07a_f224_0edbf3495fdf -->|method| e852d500_b34b_0749_b4ca_bdfcbeb993f0
  5a7db3ce_147f_fd28_211a_7ed1545445e7["teardown()"]
  cbf3710d_0610_b07a_f224_0edbf3495fdf -->|method| 5a7db3ce_147f_fd28_211a_7ed1545445e7
  a917c43b_f4f4_6a9c_6c30_9d94eb672c7f["randLong()"]
  cbf3710d_0610_b07a_f224_0edbf3495fdf -->|method| a917c43b_f4f4_6a9c_6c30_9d94eb672c7f
  57c042e3_6d28_e9a2_e661_da772c6b29e2["nextLong()"]
  cbf3710d_0610_b07a_f224_0edbf3495fdf -->|method| 57c042e3_6d28_e9a2_e661_da772c6b29e2
  0d3b1c35_c283_4084_467b_d7dadc3fe392["testRandomTcpNotSentLowAt()"]
  cbf3710d_0610_b07a_f224_0edbf3495fdf -->|method| 0d3b1c35_c283_4084_467b_d7dadc3fe392
  aea5d917_4fcb_a83b_62db_22ab35f19bbb["testInvalidHighTcpNotSentLowAt()"]
  cbf3710d_0610_b07a_f224_0edbf3495fdf -->|method| aea5d917_4fcb_a83b_62db_22ab35f19bbb
  a5f877b8_9edc_a43c_87a9_f118ade19394["testInvalidLowTcpNotSentLowAt()"]
  cbf3710d_0610_b07a_f224_0edbf3495fdf -->|method| a5f877b8_9edc_a43c_87a9_f118ade19394
  b0b5ed04_f14c_f327_4a79_369eacb6c477["testTcpCork()"]
  cbf3710d_0610_b07a_f224_0edbf3495fdf -->|method| b0b5ed04_f14c_f327_4a79_369eacb6c477
  5e75ee1f_3d68_52b4_0597_46de41c4deba["testTcpQickAck()"]
  cbf3710d_0610_b07a_f224_0edbf3495fdf -->|method| 5e75ee1f_3d68_52b4_0597_46de41c4deba
  b86d0952_f9c1_ac6a_4c43_11ae5af2063b["testSetOptionWhenClosed()"]
  cbf3710d_0610_b07a_f224_0edbf3495fdf -->|method| b86d0952_f9c1_ac6a_4c43_11ae5af2063b
  1e43840a_a33f_beeb_d83d_27ce1295a79d["testGetOptionWhenClosed()"]
  cbf3710d_0610_b07a_f224_0edbf3495fdf -->|method| 1e43840a_a33f_beeb_d83d_27ce1295a79d

Relationship Graph

Source Code

transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketChannelConfigTest.java lines 45–179

public class EpollSocketChannelConfigTest {

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

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

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

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

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

    private static long randLong(long min, long max) {
        return min + nextLong(max - min + 1);
    }

    private static long nextLong(long n) {
        long bits, val;
        do {
           bits = (rand.nextLong() << 1) >>> 1;
           val = bits % n;
        } while (bits - val + (n - 1) < 0L);
        return val;
     }

    @Test
    public void testRandomTcpNotSentLowAt() {
        final long expected = randLong(0, 0xFFFFFFFFL);
        final long actual;
        try {
            ch.config().setTcpNotSentLowAt(expected);
            actual = ch.config().getTcpNotSentLowAt();
        } catch (RuntimeException e) {
            throw new TestAbortedException("assumeNoException", e);
        }
        assertEquals(expected, actual);
    }

    @Test
    public void testInvalidHighTcpNotSentLowAt() {
        try {
            final long value = 0xFFFFFFFFL + 1;
            ch.config().setTcpNotSentLowAt(value);
        } catch (IllegalArgumentException e) {
            return;
        } catch (RuntimeException e) {
            throw new TestAbortedException("assumeNoException", e);
        }
        fail();
    }

    @Test
    public void testInvalidLowTcpNotSentLowAt() {
        try {
            final long value = -1;
            ch.config().setTcpNotSentLowAt(value);
        } catch (IllegalArgumentException e) {
            return;
        } catch (RuntimeException e) {
            throw new TestAbortedException("assumeNoException", e);
        }
        fail();

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free