EpollSocketTcpMd5Test Class — netty Architecture
Architecture documentation for the EpollSocketTcpMd5Test class in EpollSocketTcpMd5Test.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 4ad7f2f4_20c9_39d9_b4a2_dd9acb80ba6d["EpollSocketTcpMd5Test"] 5068f4c8_0d75_1d45_2723_2168e73c79e3["EpollSocketTcpMd5Test.java"] 4ad7f2f4_20c9_39d9_b4a2_dd9acb80ba6d -->|defined in| 5068f4c8_0d75_1d45_2723_2168e73c79e3 4afd359c_5895_3f92_6db8_c3ecc21093dc["beforeClass()"] 4ad7f2f4_20c9_39d9_b4a2_dd9acb80ba6d -->|method| 4afd359c_5895_3f92_6db8_c3ecc21093dc ba354e93_b086_8813_0211_09e25e8b742b["afterClass()"] 4ad7f2f4_20c9_39d9_b4a2_dd9acb80ba6d -->|method| ba354e93_b086_8813_0211_09e25e8b742b ef039b2e_ec69_618b_4093_039193794a24["setup()"] 4ad7f2f4_20c9_39d9_b4a2_dd9acb80ba6d -->|method| ef039b2e_ec69_618b_4093_039193794a24 6290b335_479c_eee9_879b_38f4d6ed12f1["teardown()"] 4ad7f2f4_20c9_39d9_b4a2_dd9acb80ba6d -->|method| 6290b335_479c_eee9_879b_38f4d6ed12f1 fe12e1f7_e859_7c1c_55bd_5ffe279d6b6d["testServerSocketChannelOption()"] 4ad7f2f4_20c9_39d9_b4a2_dd9acb80ba6d -->|method| fe12e1f7_e859_7c1c_55bd_5ffe279d6b6d de3d1602_7245_e829_980d_ec2b06897ef9["handleException()"] 4ad7f2f4_20c9_39d9_b4a2_dd9acb80ba6d -->|method| de3d1602_7245_e829_980d_ec2b06897ef9 f757b65f_b1d3_dc89_5070_e2b7f1e2eeab["testServerOption()"] 4ad7f2f4_20c9_39d9_b4a2_dd9acb80ba6d -->|method| f757b65f_b1d3_dc89_5070_e2b7f1e2eeab 33c4a1f1_08d9_e303_45b6_dae4fcaafca7["testKeyMismatch()"] 4ad7f2f4_20c9_39d9_b4a2_dd9acb80ba6d -->|method| 33c4a1f1_08d9_e303_45b6_dae4fcaafca7 f87e0da2_6453_e575_af3a_19d254719c3f["testKeyMatch()"] 4ad7f2f4_20c9_39d9_b4a2_dd9acb80ba6d -->|method| f87e0da2_6453_e575_af3a_19d254719c3f
Relationship Graph
Source Code
transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketTcpMd5Test.java lines 42–152
public class EpollSocketTcpMd5Test {
private static final byte[] SERVER_KEY = "abc".getBytes(CharsetUtil.US_ASCII);
private static final byte[] BAD_KEY = "def".getBytes(CharsetUtil.US_ASCII);
private static EventLoopGroup GROUP;
private EpollServerSocketChannel server;
@BeforeAll
public static void beforeClass() {
GROUP = new MultiThreadIoEventLoopGroup(1, EpollIoHandler.newFactory());
}
@AfterAll
public static void afterClass() {
GROUP.shutdownGracefully();
}
@BeforeEach
public void setup() {
ServerBootstrap bootstrap = new ServerBootstrap();
server = (EpollServerSocketChannel) bootstrap.group(GROUP)
.channel(EpollServerSocketChannel.class)
.childHandler(new ChannelInboundHandlerAdapter())
.bind(new InetSocketAddress(NetUtil.LOCALHOST4, 0)).syncUninterruptibly().channel();
}
@AfterEach
public void teardown() {
server.close().syncUninterruptibly();
}
@Test
public void testServerSocketChannelOption() throws Exception {
try {
server.config().setOption(EpollChannelOption.TCP_MD5SIG,
Collections.<InetAddress, byte[]>singletonMap(NetUtil.LOCALHOST4, SERVER_KEY));
server.config().setOption(EpollChannelOption.TCP_MD5SIG, Collections.<InetAddress, byte[]>emptyMap());
} catch (ChannelException ce) {
handleException(ce);
}
}
private static void handleException(ChannelException ce) {
if (ce.getMessage().contains("Protocol not available")) {
// Some operating systems don't allow or support the TCP_MD5SIG option.
// Abort the test (instead of failing) if that's the case.
Assumptions.abort(ce.getMessage());
}
throw ce;
}
@Test
public void testServerOption() throws Exception {
ServerBootstrap bootstrap = new ServerBootstrap();
EpollServerSocketChannel ch = (EpollServerSocketChannel) bootstrap.group(GROUP)
.channel(EpollServerSocketChannel.class)
.childHandler(new ChannelInboundHandlerAdapter())
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
try {
ch.config().setOption(EpollChannelOption.TCP_MD5SIG,
Collections.<InetAddress, byte[]>singletonMap(NetUtil.LOCALHOST4, SERVER_KEY));
ch.config().setOption(EpollChannelOption.TCP_MD5SIG, Collections.<InetAddress, byte[]>emptyMap());
} catch (ChannelException ce) {
handleException(ce);
} finally {
ch.close().syncUninterruptibly();
}
}
@Test
public void testKeyMismatch() throws Exception {
try {
server.config().setOption(EpollChannelOption.TCP_MD5SIG,
Collections.<InetAddress, byte[]>singletonMap(NetUtil.LOCALHOST4, SERVER_KEY));
} catch (ChannelException ce) {
handleException(ce);
}
assertThrows(ConnectTimeoutException.class, new Executable() {
@Override
public void execute() throws Throwable {
Source
Frequently Asked Questions
What is the EpollSocketTcpMd5Test class?
EpollSocketTcpMd5Test is a class in the netty codebase, defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketTcpMd5Test.java.
Where is EpollSocketTcpMd5Test defined?
EpollSocketTcpMd5Test is defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketTcpMd5Test.java at line 42.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free