Home / Function/ initChannel() — netty Function Reference

initChannel() — netty Function Reference

Architecture documentation for the initChannel() function in SecureChatClientInitializer.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e1c492f6_9b00_a2d9_14f0_ec93dcc74f6e["initChannel()"]
  892facb3_a415_efca_1cb7_5959195496d8["SecureChatClientInitializer"]
  e1c492f6_9b00_a2d9_14f0_ec93dcc74f6e -->|defined in| 892facb3_a415_efca_1cb7_5959195496d8
  style e1c492f6_9b00_a2d9_14f0_ec93dcc74f6e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/securechat/SecureChatClientInitializer.java lines 38–56

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

Domain

Subdomains

Frequently Asked Questions

What does initChannel() do?
initChannel() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/securechat/SecureChatClientInitializer.java.
Where is initChannel() defined?
initChannel() is defined in example/src/main/java/io/netty/example/securechat/SecureChatClientInitializer.java at line 38.

Analyze Your Own Codebase

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

Try Supermodel Free