Home / Function/ main() — netty Function Reference

main() — netty Function Reference

Architecture documentation for the main() function in DiscardClient.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  1d9d3c3a_2968_a99a_23bd_cbd00ea35915["main()"]
  91b8af10_120c_ade8_b41a_480990d8a12d["DiscardClient"]
  1d9d3c3a_2968_a99a_23bd_cbd00ea35915 -->|defined in| 91b8af10_120c_ade8_b41a_480990d8a12d
  style 1d9d3c3a_2968_a99a_23bd_cbd00ea35915 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/discard/DiscardClient.java lines 39–67

    public static void main(String[] args) throws Exception {
        // Configure SSL.
        final SslContext sslCtx = ServerUtil.buildSslContext();

        EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
        try {
            Bootstrap b = new Bootstrap();
            b.group(group)
             .channel(NioSocketChannel.class)
             .handler(new ChannelInitializer<SocketChannel>() {
                 @Override
                 protected void initChannel(SocketChannel ch) throws Exception {
                     ChannelPipeline p = ch.pipeline();
                     if (sslCtx != null) {
                         p.addLast(sslCtx.newHandler(ch.alloc(), HOST, PORT));
                     }
                     p.addLast(new DiscardClientHandler());
                 }
             });

            // Make the connection attempt.
            ChannelFuture f = b.connect(HOST, PORT).sync();

            // Wait until the connection is closed.
            f.channel().closeFuture().sync();
        } finally {
            group.shutdownGracefully();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does main() do?
main() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/discard/DiscardClient.java.
Where is main() defined?
main() is defined in example/src/main/java/io/netty/example/discard/DiscardClient.java at line 39.

Analyze Your Own Codebase

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

Try Supermodel Free