OCSPTest Class — netty Architecture
Architecture documentation for the OCSPTest class in OCSPTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD d651cfe3_452c_bc2f_8ab1_5b28b9161b54["OCSPTest"] 0cac2dd9_2357_e1e0_15f1_d6c81d84afd4["OCSPTest.java"] d651cfe3_452c_bc2f_8ab1_5b28b9161b54 -->|defined in| 0cac2dd9_2357_e1e0_15f1_d6c81d84afd4 e5937798_f45f_a653_4c16_4f5c423d4f7a["testSimpleQueryTest()"] d651cfe3_452c_bc2f_8ab1_5b28b9161b54 -->|method| e5937798_f45f_a653_4c16_4f5c423d4f7a
Relationship Graph
Source Code
testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/OCSPTest.java lines 44–101
public class OCSPTest {
@Test
public void testSimpleQueryTest() throws Exception {
final AtomicBoolean ocspStatus = new AtomicBoolean();
EventLoopGroup eventLoopGroup = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
try {
final CountDownLatch latch = new CountDownLatch(1);
final SslContext sslContext = SslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE)
.build();
Bootstrap bootstrap = new Bootstrap()
.group(eventLoopGroup)
.channel(NioSocketChannel.class)
.option(ChannelOption.TCP_NODELAY, true)
.handler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch) {
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast(sslContext.newHandler(ch.alloc(), "netty.io", 443));
pipeline.addLast(new OcspServerCertificateValidator(false));
pipeline.addLast(new SimpleChannelInboundHandler<>() {
@Override
protected void channelRead0(ChannelHandlerContext ctx, Object msg) {
// NOOP
}
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
if (evt instanceof OcspValidationEvent) {
OcspValidationEvent event = (OcspValidationEvent) evt;
ocspStatus.set(event.response().status() == OcspResponse.Status.VALID);
ctx.channel().close();
latch.countDown();
}
}
});
}
});
ChannelFuture channelFuture = bootstrap.connect("netty.io", 443);
channelFuture.sync();
// Wait for maximum of 1 minute for Ocsp validation to happen
latch.await(1, TimeUnit.MINUTES);
assertTrue(ocspStatus.get());
// Wait for Channel to be closed
channelFuture.channel().closeFuture().sync();
} finally {
eventLoopGroup.shutdownGracefully();
}
}
}
Source
Frequently Asked Questions
What is the OCSPTest class?
OCSPTest is a class in the netty codebase, defined in testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/OCSPTest.java.
Where is OCSPTest defined?
OCSPTest is defined in testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/OCSPTest.java at line 44.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free