Home / Function/ newClientHandler() — netty Function Reference

newClientHandler() — netty Function Reference

Architecture documentation for the newClientHandler() function in OcspClientExample.java from the netty codebase.

Function java Buffer Allocators calls 4 called by 1

Entity Profile

Dependency Diagram

graph TD
  447e7dc1_343c_edfd_88f0_01d4df3f2d14["newClientHandler()"]
  b9432e46_513a_9655_4561_4a9c7c3a3848["OcspClientExample"]
  447e7dc1_343c_edfd_88f0_01d4df3f2d14 -->|defined in| b9432e46_513a_9655_4561_4a9c7c3a3848
  d4458b73_b004_4daf_0b0c_59a3db2c8882["main()"]
  d4458b73_b004_4daf_0b0c_59a3db2c8882 -->|calls| 447e7dc1_343c_edfd_88f0_01d4df3f2d14
  c83912b3_2a3c_4f9b_d837_ac84708794d8["ExampleOcspClientHandler()"]
  447e7dc1_343c_edfd_88f0_01d4df3f2d14 -->|calls| c83912b3_2a3c_4f9b_d837_ac84708794d8
  28cf4fac_54d5_f010_d80d_800e8c4bfa89["HttpClientHandler()"]
  447e7dc1_343c_edfd_88f0_01d4df3f2d14 -->|calls| 28cf4fac_54d5_f010_d80d_800e8c4bfa89
  26b69687_a861_74d4_aa52_509b6cf27905["channelInactive()"]
  447e7dc1_343c_edfd_88f0_01d4df3f2d14 -->|calls| 26b69687_a861_74d4_aa52_509b6cf27905
  68c47f62_7713_7342_b31e_d3fd13efdb85["exceptionCaught()"]
  447e7dc1_343c_edfd_88f0_01d4df3f2d14 -->|calls| 68c47f62_7713_7342_b31e_d3fd13efdb85
  style 447e7dc1_343c_edfd_88f0_01d4df3f2d14 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/ocsp/OcspClientExample.java lines 120–154

    private static ChannelInitializer<Channel> newClientHandler(final ReferenceCountedOpenSslContext context,
            final String host, final Promise<FullHttpResponse> promise) {

        return new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) throws Exception {
                SslHandler sslHandler = context.newHandler(ch.alloc());
                ReferenceCountedOpenSslEngine engine
                    = (ReferenceCountedOpenSslEngine) sslHandler.engine();

                ChannelPipeline pipeline = ch.pipeline();
                pipeline.addLast(sslHandler);
                pipeline.addLast(new ExampleOcspClientHandler(engine));

                pipeline.addLast(new HttpClientCodec());
                pipeline.addLast(new HttpObjectAggregator(1024 * 1024));
                pipeline.addLast(new HttpClientHandler(host, promise));
            }

            @Override
            public void channelInactive(ChannelHandlerContext ctx) throws Exception {
                if (!promise.isDone()) {
                    promise.tryFailure(new IllegalStateException("Connection closed and Promise was not done."));
                }
                ctx.fireChannelInactive();
            }

            @Override
            public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
                if (!promise.tryFailure(cause)) {
                    ctx.fireExceptionCaught(cause);
                }
            }
        };
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does newClientHandler() do?
newClientHandler() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/ocsp/OcspClientExample.java.
Where is newClientHandler() defined?
newClientHandler() is defined in example/src/main/java/io/netty/example/ocsp/OcspClientExample.java at line 120.
What does newClientHandler() call?
newClientHandler() calls 4 function(s): ExampleOcspClientHandler, HttpClientHandler, channelInactive, exceptionCaught.
What calls newClientHandler()?
newClientHandler() is called by 1 function(s): main.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free