OcspServerCertificateValidatorTest Class — netty Architecture
Architecture documentation for the OcspServerCertificateValidatorTest class in OcspServerCertificateValidatorTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 6e4ab173_5fa8_49eb_3976_e927c5435ba9["OcspServerCertificateValidatorTest"] a44eb949_f957_64be_0f7a_dfccd6ac199d["OcspServerCertificateValidatorTest.java"] 6e4ab173_5fa8_49eb_3976_e927c5435ba9 -->|defined in| a44eb949_f957_64be_0f7a_dfccd6ac199d 9e74b6c7_52ae_dbaf_7567_2cded7385e15["connectUsingHttpAndValidateCertificateUsingOcspTest()"] 6e4ab173_5fa8_49eb_3976_e927c5435ba9 -->|method| 9e74b6c7_52ae_dbaf_7567_2cded7385e15
Relationship Graph
Source Code
handler-ssl-ocsp/src/test/java/io/netty/handler/ssl/ocsp/OcspServerCertificateValidatorTest.java lines 41–97
class OcspServerCertificateValidatorTest extends AbstractOcspTest {
@Test
void connectUsingHttpAndValidateCertificateUsingOcspTest() 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, createDefaultTransport()));
pipeline.addLast(new SimpleChannelInboundHandler<Object>() {
@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();
}
}
}
Defined In
Source
Frequently Asked Questions
What is the OcspServerCertificateValidatorTest class?
OcspServerCertificateValidatorTest is a class in the netty codebase, defined in handler-ssl-ocsp/src/test/java/io/netty/handler/ssl/ocsp/OcspServerCertificateValidatorTest.java.
Where is OcspServerCertificateValidatorTest defined?
OcspServerCertificateValidatorTest is defined in handler-ssl-ocsp/src/test/java/io/netty/handler/ssl/ocsp/OcspServerCertificateValidatorTest.java at line 41.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free