Home / Class/ SecureChatServerInitializer Class — netty Architecture

SecureChatServerInitializer Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  d3f17d8c_a3f5_b8d7_e3b2_7be21f8afe16["SecureChatServerInitializer"]
  54b07175_db4b_f947_5c0b_533d8b446620["SecureChatServerInitializer.java"]
  d3f17d8c_a3f5_b8d7_e3b2_7be21f8afe16 -->|defined in| 54b07175_db4b_f947_5c0b_533d8b446620
  f4a9a346_0ec2_c7db_4e51_d8dc54c2f477["SecureChatServerInitializer()"]
  d3f17d8c_a3f5_b8d7_e3b2_7be21f8afe16 -->|method| f4a9a346_0ec2_c7db_4e51_d8dc54c2f477
  8d5fde3e_a114_594d_a74e_3ef3a28714f2["initChannel()"]
  d3f17d8c_a3f5_b8d7_e3b2_7be21f8afe16 -->|method| 8d5fde3e_a114_594d_a74e_3ef3a28714f2

Relationship Graph

Source Code

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

public class SecureChatServerInitializer extends ChannelInitializer<SocketChannel> {

    private final SslContext sslCtx;

    public SecureChatServerInitializer(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()));

        // 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 SecureChatServerHandler());
    }
}

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free