Home / Class/ SecureChatClientInitializer Class — netty Architecture

SecureChatClientInitializer Class — netty Architecture

Architecture documentation for the SecureChatClientInitializer class in SecureChatClientInitializer.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  892facb3_a415_efca_1cb7_5959195496d8["SecureChatClientInitializer"]
  51fb75f9_3b16_c52b_4003_f7b8cda5e53e["SecureChatClientInitializer.java"]
  892facb3_a415_efca_1cb7_5959195496d8 -->|defined in| 51fb75f9_3b16_c52b_4003_f7b8cda5e53e
  546dfa50_f17e_2ecc_7947_f564d009ca7b["SecureChatClientInitializer()"]
  892facb3_a415_efca_1cb7_5959195496d8 -->|method| 546dfa50_f17e_2ecc_7947_f564d009ca7b
  e1c492f6_9b00_a2d9_14f0_ec93dcc74f6e["initChannel()"]
  892facb3_a415_efca_1cb7_5959195496d8 -->|method| e1c492f6_9b00_a2d9_14f0_ec93dcc74f6e

Relationship Graph

Source Code

example/src/main/java/io/netty/example/securechat/SecureChatClientInitializer.java lines 30–57

public class SecureChatClientInitializer extends ChannelInitializer<SocketChannel> {

    private final SslContext sslCtx;

    public SecureChatClientInitializer(SslContext sslCtx) {
        this.sslCtx = sslCtx;
    }

    @Override
    public void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();

        // Add SSL handler first to encrypt and decrypt everything.
        // In this example, we use a bogus certificate in the server side
        // and accept any invalid certificates in the client side.
        // You will need something more complicated to identify both
        // and server in the real world.
        pipeline.addLast(sslCtx.newHandler(ch.alloc(), SecureChatClient.HOST, SecureChatClient.PORT));

        // On top of the SSL handler, add the text line codec.
        pipeline.addLast(new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter()));
        pipeline.addLast(new StringDecoder());
        pipeline.addLast(new StringEncoder());

        // and then business logic.
        pipeline.addLast(new SecureChatClientHandler());
    }
}

Frequently Asked Questions

What is the SecureChatClientInitializer class?
SecureChatClientInitializer is a class in the netty codebase, defined in example/src/main/java/io/netty/example/securechat/SecureChatClientInitializer.java.
Where is SecureChatClientInitializer defined?
SecureChatClientInitializer is defined in example/src/main/java/io/netty/example/securechat/SecureChatClientInitializer.java at line 30.

Analyze Your Own Codebase

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

Try Supermodel Free