Home / Function/ testFireChannelReadAfterHandshakeSuccess() — netty Function Reference

testFireChannelReadAfterHandshakeSuccess() — netty Function Reference

Architecture documentation for the testFireChannelReadAfterHandshakeSuccess() function in Http2MultiplexTransportTest.java from the netty codebase.

Function java Buffer Allocators calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  7b850f8e_a40d_861e_29dd_57e0bde0185f["testFireChannelReadAfterHandshakeSuccess()"]
  91fc51f7_5bfd_40ef_a0e8_b98c3ed99f48["Http2MultiplexTransportTest"]
  7b850f8e_a40d_861e_29dd_57e0bde0185f -->|defined in| 91fc51f7_5bfd_40ef_a0e8_b98c3ed99f48
  70168125_b740_c3ee_4136_86d4c01273b9["testFireChannelReadAfterHandshakeSuccess_JDK()"]
  70168125_b740_c3ee_4136_86d4c01273b9 -->|calls| 7b850f8e_a40d_861e_29dd_57e0bde0185f
  7b0dd5ce_b3ab_2a4f_a73b_76ed669595f2["testFireChannelReadAfterHandshakeSuccess_OPENSSL()"]
  7b0dd5ce_b3ab_2a4f_a73b_76ed669595f2 -->|calls| 7b850f8e_a40d_861e_29dd_57e0bde0185f
  ddc09e7c_92de_4aa4_bf62_25ac0d49ef36["channelRead()"]
  7b850f8e_a40d_861e_29dd_57e0bde0185f -->|calls| ddc09e7c_92de_4aa4_bf62_25ac0d49ef36
  style 7b850f8e_a40d_861e_29dd_57e0bde0185f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java lines 537–643

    private void testFireChannelReadAfterHandshakeSuccess(SslProvider provider) throws Exception {
        X509Bundle cert = new CertificateBuilder()
                .subject("cn=localhost")
                .setIsCertificateAuthority(true)
                .buildSelfSigned();
        final SslContext serverCtx = SslContextBuilder.forServer(cert.getKeyPair().getPrivate(),
                        cert.getCertificatePath())
                .sslProvider(provider)
                .ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE)
                .applicationProtocolConfig(new ApplicationProtocolConfig(
                        ApplicationProtocolConfig.Protocol.ALPN,
                        ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE,
                        ApplicationProtocolConfig.SelectedListenerFailureBehavior.ACCEPT,
                        ApplicationProtocolNames.HTTP_2,
                        ApplicationProtocolNames.HTTP_1_1))
                .build();

        ServerBootstrap sb = new ServerBootstrap();
        sb.group(eventLoopGroup);
        sb.channel(NioServerSocketChannel.class);
        sb.childHandler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) {
                ch.pipeline().addLast(serverCtx.newHandler(ch.alloc()));
                ch.pipeline().addLast(new ApplicationProtocolNegotiationHandler(ApplicationProtocolNames.HTTP_1_1) {
                    @Override
                    protected void configurePipeline(ChannelHandlerContext ctx, String protocol) {
                        ctx.pipeline().addLast(new Http2FrameCodecBuilder(true).build());
                        ctx.pipeline().addLast(new Http2MultiplexHandler(new ChannelInboundHandlerAdapter() {
                            @Override
                            public void channelRead(final ChannelHandlerContext ctx, Object msg) {
                                if (msg instanceof Http2HeadersFrame && ((Http2HeadersFrame) msg).isEndStream()) {
                                    ctx.writeAndFlush(new DefaultHttp2HeadersFrame(
                                                    new DefaultHttp2Headers(), false))
                                            .addListener((ChannelFutureListener) future ->
                                                    ctx.writeAndFlush(new DefaultHttp2DataFrame(
                                                            Unpooled.copiedBuffer("Hello World", CharsetUtil.US_ASCII),
                                                            true)));
                                }
                                ReferenceCountUtil.release(msg);
                            }
                        }));
                    }
                });
            }
        });
        serverChannel = sb.bind(new InetSocketAddress(NetUtil.LOCALHOST, 0)).sync().channel();

        final SslContext clientCtx = SslContextBuilder.forClient()
                .sslProvider(provider)
                .ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE)
                .trustManager(InsecureTrustManagerFactory.INSTANCE)
                .applicationProtocolConfig(new ApplicationProtocolConfig(
                        ApplicationProtocolConfig.Protocol.ALPN,
                        ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE,
                        ApplicationProtocolConfig.SelectedListenerFailureBehavior.ACCEPT,
                        ApplicationProtocolNames.HTTP_2,
                        ApplicationProtocolNames.HTTP_1_1))
                .build();

        final CountDownLatch latch = new CountDownLatch(1);
        Bootstrap bs = new Bootstrap();
        bs.group(eventLoopGroup);
        bs.channel(NioSocketChannel.class);
        bs.handler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) {
                ch.pipeline().addLast(clientCtx.newHandler(ch.alloc()));
                ch.pipeline().addLast(new Http2FrameCodecBuilder(false).build());
                ch.pipeline().addLast(new Http2MultiplexHandler(DISCARD_HANDLER));
                ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
                    @Override
                    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
                        if (evt instanceof SslHandshakeCompletionEvent) {
                            SslHandshakeCompletionEvent handshakeCompletionEvent =
                                    (SslHandshakeCompletionEvent) evt;
                            if (handshakeCompletionEvent.isSuccess()) {
                                Http2StreamChannelBootstrap h2Bootstrap =
                                        new Http2StreamChannelBootstrap(ctx.channel());
                                h2Bootstrap.handler(new ChannelInboundHandlerAdapter() {
                                    @Override

Domain

Subdomains

Frequently Asked Questions

What does testFireChannelReadAfterHandshakeSuccess() do?
testFireChannelReadAfterHandshakeSuccess() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java.
Where is testFireChannelReadAfterHandshakeSuccess() defined?
testFireChannelReadAfterHandshakeSuccess() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java at line 537.
What does testFireChannelReadAfterHandshakeSuccess() call?
testFireChannelReadAfterHandshakeSuccess() calls 1 function(s): channelRead.
What calls testFireChannelReadAfterHandshakeSuccess()?
testFireChannelReadAfterHandshakeSuccess() is called by 2 function(s): testFireChannelReadAfterHandshakeSuccess_JDK, testFireChannelReadAfterHandshakeSuccess_OPENSSL.

Analyze Your Own Codebase

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

Try Supermodel Free