main() — netty Function Reference
Architecture documentation for the main() function in OcspClientExample.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD d4458b73_b004_4daf_0b0c_59a3db2c8882["main()"] b9432e46_513a_9655_4561_4a9c7c3a3848["OcspClientExample"] d4458b73_b004_4daf_0b0c_59a3db2c8882 -->|defined in| b9432e46_513a_9655_4561_4a9c7c3a3848 447e7dc1_343c_edfd_88f0_01d4df3f2d14["newClientHandler()"] d4458b73_b004_4daf_0b0c_59a3db2c8882 -->|calls| 447e7dc1_343c_edfd_88f0_01d4df3f2d14 style d4458b73_b004_4daf_0b0c_59a3db2c8882 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
example/src/main/java/io/netty/example/ocsp/OcspClientExample.java lines 67–118
public static void main(String[] args) throws Exception {
if (!OpenSsl.isAvailable()) {
throw new IllegalStateException("OpenSSL is not available!");
}
if (!OpenSsl.isOcspSupported()) {
throw new IllegalStateException("OCSP is not supported!");
}
// Using Wikipedia as an example. I'd rather use Netty's own website
// but the server (Cloudflare) doesn't support OCSP stapling. A few
// other examples could be Microsoft or Squarespace. Use OpenSSL's
// CLI client to assess if a server supports OCSP stapling. E.g.:
//
// openssl s_client -tlsextdebug -status -connect www.squarespace.com:443
//
String host = "www.wikipedia.org";
ReferenceCountedOpenSslContext context
= (ReferenceCountedOpenSslContext) SslContextBuilder.forClient()
.sslProvider(SslProvider.OPENSSL)
.enableOcsp(true)
.build();
try {
EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
try {
Promise<FullHttpResponse> promise = group.next().newPromise();
Bootstrap bootstrap = new Bootstrap()
.channel(NioSocketChannel.class)
.group(group)
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 5 * 1000)
.handler(newClientHandler(context, host, promise));
Channel channel = bootstrap.connect(host, 443)
.syncUninterruptibly()
.channel();
try {
FullHttpResponse response = promise.get();
ReferenceCountUtil.release(response);
} finally {
channel.close();
}
} finally {
group.shutdownGracefully();
}
} finally {
context.release();
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does main() do?
main() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/ocsp/OcspClientExample.java.
Where is main() defined?
main() is defined in example/src/main/java/io/netty/example/ocsp/OcspClientExample.java at line 67.
What does main() call?
main() calls 1 function(s): newClientHandler.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free