Home / Function/ Channel() — netty Function Reference

Channel() — netty Function Reference

Architecture documentation for the Channel() function in CodecHttp3Test.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  9ec75400_63dc_777d_5183_46f05f0ffe14["Channel()"]
  6c8fb13b_b80f_3665_36aa_58857fdc6fd3["CodecHttp3Test"]
  9ec75400_63dc_777d_5183_46f05f0ffe14 -->|defined in| 6c8fb13b_b80f_3665_36aa_58857fdc6fd3
  style 9ec75400_63dc_777d_5183_46f05f0ffe14 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/CodecHttp3Test.java lines 140–197

    private Channel startServer(EventLoopGroup group, int port) throws InterruptedException, CertificateException {
        SelfSignedCertificate cert = new SelfSignedCertificate();
        QuicSslContext sslContext = QuicSslContextBuilder.forServer(cert.key(), null, cert.cert())
                .applicationProtocols(Http3.supportedApplicationProtocols()).build();
        ChannelHandler codec = Http3.newQuicServerCodecBuilder()
                .sslContext(sslContext)
                .maxIdleTimeout(5000, TimeUnit.MILLISECONDS)
                .initialMaxData(10000000)
                .initialMaxStreamDataBidirectionalLocal(1000000)
                .initialMaxStreamDataBidirectionalRemote(1000000)
                .initialMaxStreamsBidirectional(100)
                .tokenHandler(InsecureQuicTokenHandler.INSTANCE)
                .handler(new ChannelInitializer<QuicChannel>() {
                    @Override
                    protected void initChannel(QuicChannel ch) {
                        // Called for each connection
                        ch.pipeline().addLast(new Http3ServerConnectionHandler(
                                new ChannelInitializer<QuicStreamChannel>() {
                                    // Called for each request-stream,
                                    @Override
                                    protected void initChannel(QuicStreamChannel ch) {
                                        ch.pipeline().addLast(new Http3RequestStreamInboundHandler() {

                                            @Override
                                            protected void channelRead(
                                                    ChannelHandlerContext ctx, Http3HeadersFrame frame) {
                                                ReferenceCountUtil.release(frame);
                                            }

                                            @Override
                                            protected void channelRead(
                                                    ChannelHandlerContext ctx, Http3DataFrame frame) {
                                                ReferenceCountUtil.release(frame);
                                            }

                                            @Override
                                            protected void channelInputClosed(ChannelHandlerContext ctx) {
                                                Http3HeadersFrame headersFrame = new DefaultHttp3HeadersFrame();
                                                headersFrame.headers().status("404");
                                                headersFrame.headers().add("server", "netty");
                                                headersFrame.headers().addInt("content-length", CONTENT.length);
                                                ctx.write(headersFrame);
                                                ctx.writeAndFlush(new DefaultHttp3DataFrame(
                                                                Unpooled.wrappedBuffer(CONTENT)))
                                                        .addListener(QuicStreamChannel.SHUTDOWN_OUTPUT);
                                            }
                                        });
                                    }
                                }));
                    }
                }).build();

        Bootstrap bs = new Bootstrap();
        return bs.group(group)
                .channel(NioDatagramChannel.class)
                .handler(codec)
                .bind(new InetSocketAddress(port)).sync().channel();
    }

Domain

Subdomains

Frequently Asked Questions

What does Channel() do?
Channel() is a function in the netty codebase, defined in testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/CodecHttp3Test.java.
Where is Channel() defined?
Channel() is defined in testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/CodecHttp3Test.java at line 140.

Analyze Your Own Codebase

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

Try Supermodel Free