testSslHandlerWrapAllowsBlockingCalls() — netty Function Reference
Architecture documentation for the testSslHandlerWrapAllowsBlockingCalls() function in NettyBlockHoundIntegrationTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 4aa3eda7_d2de_0209_d449_a4b9b24fff5c["testSslHandlerWrapAllowsBlockingCalls()"] 746a8721_66e8_40dd_5dc1_a4c697fa84e4["NettyBlockHoundIntegrationTest"] 4aa3eda7_d2de_0209_d449_a4b9b24fff5c -->|defined in| 746a8721_66e8_40dd_5dc1_a4c697fa84e4 style 4aa3eda7_d2de_0209_d449_a4b9b24fff5c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java lines 296–365
@Test
public void testSslHandlerWrapAllowsBlockingCalls() throws Exception {
final SslContext sslClientCtx = SslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE)
.sslProvider(SslProvider.JDK)
.endpointIdentificationAlgorithm(null)
.build();
final SslHandler sslHandler = sslClientCtx.newHandler(UnpooledByteBufAllocator.DEFAULT);
EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
final CountDownLatch activeLatch = new CountDownLatch(1);
final AtomicReference<Throwable> error = new AtomicReference<>();
Channel sc = null;
Channel cc = null;
try {
sc = new ServerBootstrap()
.group(group)
.channel(NioServerSocketChannel.class)
.childHandler(new ChannelInboundHandlerAdapter())
.bind(new InetSocketAddress(0))
.syncUninterruptibly()
.channel();
cc = new Bootstrap()
.group(group)
.channel(NioSocketChannel.class)
.handler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel ch) {
ch.pipeline().addLast(sslHandler);
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
@Override
public void channelActive(ChannelHandlerContext ctx) {
activeLatch.countDown();
}
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
if (evt instanceof SslHandshakeCompletionEvent &&
((SslHandshakeCompletionEvent) evt).cause() != null) {
Throwable cause = ((SslHandshakeCompletionEvent) evt).cause();
cause.printStackTrace();
error.set(cause);
}
ctx.fireUserEventTriggered(evt);
}
});
}
})
.connect(sc.localAddress())
.addListener((ChannelFutureListener) future ->
future.channel().writeAndFlush(wrappedBuffer(new byte [] { 1, 2, 3, 4 })))
.syncUninterruptibly()
.channel();
assertTrue(activeLatch.await(5, TimeUnit.SECONDS));
assertNull(error.get());
} finally {
if (cc != null) {
cc.close().syncUninterruptibly();
}
if (sc != null) {
sc.close().syncUninterruptibly();
}
group.shutdownGracefully();
ReferenceCountUtil.release(sslClientCtx);
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does testSslHandlerWrapAllowsBlockingCalls() do?
testSslHandlerWrapAllowsBlockingCalls() is a function in the netty codebase, defined in transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java.
Where is testSslHandlerWrapAllowsBlockingCalls() defined?
testSslHandlerWrapAllowsBlockingCalls() is defined in transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java at line 296.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free