Home / Function/ main() — netty Function Reference

main() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  f16e3b55_a443_c327_5820_c07ab5f8ce46["main()"]
  d90bbad3_1743_2151_740b_be5998925d7a["PortUnificationServer"]
  f16e3b55_a443_c327_5820_c07ab5f8ce46 -->|defined in| d90bbad3_1743_2151_740b_be5998925d7a
  style f16e3b55_a443_c327_5820_c07ab5f8ce46 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/portunification/PortUnificationServer.java lines 43–70

    public static void main(String[] args) throws Exception {
        // Configure SSL context
        X509Bundle ssc = new CertificateBuilder()
                .subject("cn=localhost")
                .setIsCertificateAuthority(true)
                .buildSelfSigned();
        final SslContext sslCtx = SslContextBuilder.forServer(ssc.toKeyManagerFactory())
            .build();

        EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
        try {
            ServerBootstrap b = new ServerBootstrap();
            b.group(group)
             .channel(NioServerSocketChannel.class)
             .handler(new LoggingHandler(LogLevel.INFO))
             .childHandler(new ChannelInitializer<SocketChannel>() {
                @Override
                public void initChannel(SocketChannel ch) throws Exception {
                    ch.pipeline().addLast(new PortUnificationServerHandler(sslCtx));
                }
            });

            // Bind and start to accept incoming connections.
            b.bind(PORT).sync().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/portunification/PortUnificationServer.java.
Where is main() defined?
main() is defined in example/src/main/java/io/netty/example/portunification/PortUnificationServer.java at line 43.

Analyze Your Own Codebase

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

Try Supermodel Free