Home / Class/ TelnetServerInitializer Class — netty Architecture

TelnetServerInitializer Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  6c5d041f_5c09_62f6_b9a1_64e97aca427f["TelnetServerInitializer"]
  7a253c97_3732_a1da_0ee4_36aac18aa30a["TelnetServerInitializer.java"]
  6c5d041f_5c09_62f6_b9a1_64e97aca427f -->|defined in| 7a253c97_3732_a1da_0ee4_36aac18aa30a
  11ee35cc_d02a_7f80_fd37_958ad6f0ba80["TelnetServerInitializer()"]
  6c5d041f_5c09_62f6_b9a1_64e97aca427f -->|method| 11ee35cc_d02a_7f80_fd37_958ad6f0ba80
  28ad10df_86de_cbdf_2d27_aaf1b48ca8a3["initChannel()"]
  6c5d041f_5c09_62f6_b9a1_64e97aca427f -->|method| 28ad10df_86de_cbdf_2d27_aaf1b48ca8a3

Relationship Graph

Source Code

example/src/main/java/io/netty/example/telnet/TelnetServerInitializer.java lines 30–60

public class TelnetServerInitializer extends ChannelInitializer<SocketChannel> {

    private static final StringDecoder DECODER = new StringDecoder();
    private static final StringEncoder ENCODER = new StringEncoder();

    private static final TelnetServerHandler SERVER_HANDLER = new TelnetServerHandler();

    private final SslContext sslCtx;

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

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

        if (sslCtx != null) {
            pipeline.addLast(sslCtx.newHandler(ch.alloc()));
        }

        // Add the text line codec combination first,
        pipeline.addLast(new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter()));
        // the encoder and decoder are static as these are sharable
        pipeline.addLast(DECODER);
        pipeline.addLast(ENCODER);

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

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free