SocketShutdownOutputBySelfTest Class — netty Architecture
Architecture documentation for the SocketShutdownOutputBySelfTest class in SocketShutdownOutputBySelfTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 7c0e0e25_e115_ef04_bb8b_a0565a452d87["SocketShutdownOutputBySelfTest"] db2ccfc3_8846_6680_0c40_6e29d05f53d5["SocketShutdownOutputBySelfTest.java"] 7c0e0e25_e115_ef04_bb8b_a0565a452d87 -->|defined in| db2ccfc3_8846_6680_0c40_6e29d05f53d5 5a1daadb_d431_9e7d_226a_c1a7dc70ff9e["testShutdownOutput()"] 7c0e0e25_e115_ef04_bb8b_a0565a452d87 -->|method| 5a1daadb_d431_9e7d_226a_c1a7dc70ff9e ce9304b8_9e15_04d3_ce14_0c69c13eab18["testShutdownOutputAfterClosed()"] 7c0e0e25_e115_ef04_bb8b_a0565a452d87 -->|method| ce9304b8_9e15_04d3_ce14_0c69c13eab18 1893d378_a235_4131_0ae1_0d5498a415dc["testWriteAfterShutdownOutputNoWritabilityChange()"] 7c0e0e25_e115_ef04_bb8b_a0565a452d87 -->|method| 1893d378_a235_4131_0ae1_0d5498a415dc b3dd9482_4265_6d6b_f37b_b132c806475b["testShutdownOutputSoLingerNoAssertError()"] 7c0e0e25_e115_ef04_bb8b_a0565a452d87 -->|method| b3dd9482_4265_6d6b_f37b_b132c806475b 34e714b9_a66e_6047_9592_75daa0e580b8["testShutdownSoLingerNoAssertError()"] 7c0e0e25_e115_ef04_bb8b_a0565a452d87 -->|method| 34e714b9_a66e_6047_9592_75daa0e580b8 6dfe63e2_7d71_771a_8ba4_18207759db0e["testShutdownSoLingerNoAssertError0()"] 7c0e0e25_e115_ef04_bb8b_a0565a452d87 -->|method| 6dfe63e2_7d71_771a_8ba4_18207759db0e 7f96509c_c675_5924_328f_facada9c2606["checkThrowable()"] 7c0e0e25_e115_ef04_bb8b_a0565a452d87 -->|method| 7f96509c_c675_5924_328f_facada9c2606
Relationship Graph
Source Code
testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketShutdownOutputBySelfTest.java lines 52–322
public class SocketShutdownOutputBySelfTest extends AbstractClientSocketTest {
@Test
@Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
public void testShutdownOutput(TestInfo testInfo) throws Throwable {
run(testInfo, new Runner<Bootstrap>() {
@Override
public void run(Bootstrap bootstrap) throws Throwable {
testShutdownOutput(bootstrap);
}
});
}
public void testShutdownOutput(Bootstrap cb) throws Throwable {
TestHandler h = new TestHandler();
ServerSocket ss = new ServerSocket();
Socket s = null;
SocketChannel ch = null;
try {
ss.bind(newSocketAddress());
ch = (SocketChannel) cb.handler(h).connect(ss.getLocalSocketAddress()).sync().channel();
assertTrue(ch.isActive());
assertFalse(ch.isOutputShutdown());
s = ss.accept();
ch.writeAndFlush(randomBufferType(ch.alloc(), new byte[] { 1 }, 0, 1)).sync();
assertEquals(1, s.getInputStream().read());
assertTrue(h.ch.isOpen());
assertTrue(h.ch.isActive());
assertFalse(h.ch.isInputShutdown());
assertFalse(h.ch.isOutputShutdown());
// Make the connection half-closed and ensure read() returns -1.
ch.shutdownOutput().sync();
assertEquals(-1, s.getInputStream().read());
assertTrue(h.ch.isOpen());
assertTrue(h.ch.isActive());
assertFalse(h.ch.isInputShutdown());
assertTrue(h.ch.isOutputShutdown());
// If half-closed, the peer should be able to write something.
s.getOutputStream().write(new byte[] { 1 });
assertEquals(1, (int) h.queue.take());
} finally {
if (s != null) {
s.close();
}
if (ch != null) {
ch.close();
}
ss.close();
}
}
@Test
@Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
public void testShutdownOutputAfterClosed(TestInfo testInfo) throws Throwable {
run(testInfo, new Runner<Bootstrap>() {
@Override
public void run(Bootstrap bootstrap) throws Throwable {
testShutdownOutputAfterClosed(bootstrap);
}
});
}
public void testShutdownOutputAfterClosed(Bootstrap cb) throws Throwable {
TestHandler h = new TestHandler();
ServerSocket ss = new ServerSocket();
Socket s = null;
try {
ss.bind(newSocketAddress());
SocketChannel ch = (SocketChannel) cb.handler(h).connect(ss.getLocalSocketAddress()).sync().channel();
assertTrue(ch.isActive());
s = ss.accept();
ch.close().syncUninterruptibly();
try {
ch.shutdownInput().syncUninterruptibly();
fail();
Defined In
Source
Frequently Asked Questions
What is the SocketShutdownOutputBySelfTest class?
SocketShutdownOutputBySelfTest is a class in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketShutdownOutputBySelfTest.java.
Where is SocketShutdownOutputBySelfTest defined?
SocketShutdownOutputBySelfTest is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketShutdownOutputBySelfTest.java at line 52.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free