Home / Class/ AbstractSocketShutdownOutputByPeerTest Class — netty Architecture

AbstractSocketShutdownOutputByPeerTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  fdf26bdc_6c45_d0a9_7101_c897d4b8a7fb["AbstractSocketShutdownOutputByPeerTest"]
  f0e980fd_4a2c_04de_3608_669447e1c777["AbstractSocketShutdownOutputByPeerTest.java"]
  fdf26bdc_6c45_d0a9_7101_c897d4b8a7fb -->|defined in| f0e980fd_4a2c_04de_3608_669447e1c777
  3dc41361_29b1_015a_7135_8294659355c6["testShutdownOutput()"]
  fdf26bdc_6c45_d0a9_7101_c897d4b8a7fb -->|method| 3dc41361_29b1_015a_7135_8294659355c6
  9d16002b_ff97_3498_bea7_23280fb48541["testShutdownOutputWithoutOption()"]
  fdf26bdc_6c45_d0a9_7101_c897d4b8a7fb -->|method| 9d16002b_ff97_3498_bea7_23280fb48541
  d51797ce_3e71_df31_2b53_0be27be17b83["shutdownOutput()"]
  fdf26bdc_6c45_d0a9_7101_c897d4b8a7fb -->|method| d51797ce_3e71_df31_2b53_0be27be17b83
  0641d032_0441_6b23_b2bc_9d14f8f0dda3["connect()"]
  fdf26bdc_6c45_d0a9_7101_c897d4b8a7fb -->|method| 0641d032_0441_6b23_b2bc_9d14f8f0dda3
  3f46d59e_0980_9e53_a588_7dadec6752cf["close()"]
  fdf26bdc_6c45_d0a9_7101_c897d4b8a7fb -->|method| 3f46d59e_0980_9e53_a588_7dadec6752cf
  9b76f906_f846_106e_7b5b_be9c33fc7f06["write()"]
  fdf26bdc_6c45_d0a9_7101_c897d4b8a7fb -->|method| 9b76f906_f846_106e_7b5b_be9c33fc7f06
  c4796329_2f6a_4276_f14b_694702eb9392["Socket()"]
  fdf26bdc_6c45_d0a9_7101_c897d4b8a7fb -->|method| c4796329_2f6a_4276_f14b_694702eb9392

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketShutdownOutputByPeerTest.java lines 42–180

public abstract class AbstractSocketShutdownOutputByPeerTest<Socket> extends AbstractServerSocketTest {

    @Test
    @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
    public void testShutdownOutput(TestInfo testInfo) throws Throwable {
        run(testInfo, new Runner<ServerBootstrap>() {
            @Override
            public void run(ServerBootstrap serverBootstrap) throws Throwable {
                testShutdownOutput(serverBootstrap);
            }
        });
    }

    public void testShutdownOutput(ServerBootstrap sb) throws Throwable {
        TestHandler h = new TestHandler();
        Socket s = newSocket();
        Channel sc = null;
        try {
            sc = sb.childHandler(h).childOption(ChannelOption.ALLOW_HALF_CLOSURE, true).bind().sync().channel();

            connect(s, sc.localAddress());
            write(s, 1);

            assertEquals(1, (int) h.queue.take());

            assertTrue(h.ch.isOpen());
            assertTrue(h.ch.isActive());
            assertFalse(h.ch.isInputShutdown());
            assertFalse(h.ch.isOutputShutdown());

            shutdownOutput(s);

            h.halfClosure.await();

            assertTrue(h.ch.isOpen());
            assertTrue(h.ch.isActive());
            assertTrue(h.ch.isInputShutdown());
            assertFalse(h.ch.isOutputShutdown());

            while (h.closure.getCount() != 1 && h.halfClosureCount.intValue() != 1) {
                Thread.sleep(100);
            }
        } finally {
            if (sc != null) {
                sc.close();
            }
            close(s);
        }
    }

    @Test
    @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
    public void testShutdownOutputWithoutOption(TestInfo testInfo) throws Throwable {
        run(testInfo, new Runner<ServerBootstrap>() {
            @Override
            public void run(ServerBootstrap serverBootstrap) throws Throwable {
                testShutdownOutputWithoutOption(serverBootstrap);
            }
        });
    }

    public void testShutdownOutputWithoutOption(ServerBootstrap sb) throws Throwable {
        TestHandler h = new TestHandler();
        Socket s = newSocket();
        Channel sc = null;
        try {
            sc = sb.childHandler(h).bind().sync().channel();

            connect(s, sc.localAddress());
            write(s, 1);

            assertEquals(1, (int) h.queue.take());

            assertTrue(h.ch.isOpen());
            assertTrue(h.ch.isActive());
            assertFalse(h.ch.isInputShutdown());
            assertFalse(h.ch.isOutputShutdown());

            shutdownOutput(s);

            h.closure.await();

Frequently Asked Questions

What is the AbstractSocketShutdownOutputByPeerTest class?
AbstractSocketShutdownOutputByPeerTest is a class in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketShutdownOutputByPeerTest.java.
Where is AbstractSocketShutdownOutputByPeerTest defined?
AbstractSocketShutdownOutputByPeerTest is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketShutdownOutputByPeerTest.java at line 42.

Analyze Your Own Codebase

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

Try Supermodel Free