Home / Function/ testSslException() — netty Function Reference

testSslException() — netty Function Reference

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

Function java Buffer Allocators calls 1 called by 4

Entity Profile

Dependency Diagram

graph TD
  9be33b96_22b1_5673_9a2d_308c712e297b["testSslException()"]
  91fc51f7_5bfd_40ef_a0e8_b98c3ed99f48["Http2MultiplexTransportTest"]
  9be33b96_22b1_5673_9a2d_308c712e297b -->|defined in| 91fc51f7_5bfd_40ef_a0e8_b98c3ed99f48
  b8991c48_b56d_1f3b_c33e_4da5d0e56e06["testSSLExceptionOpenSslTLSv12()"]
  b8991c48_b56d_1f3b_c33e_4da5d0e56e06 -->|calls| 9be33b96_22b1_5673_9a2d_308c712e297b
  aa95ef06_6088_80e8_d008_c5e803938303["testSSLExceptionOpenSslTLSv13()"]
  aa95ef06_6088_80e8_d008_c5e803938303 -->|calls| 9be33b96_22b1_5673_9a2d_308c712e297b
  e51af82b_2969_7e41_c0c3_a0fb70fe6d8c["testSSLExceptionJDKTLSv12()"]
  e51af82b_2969_7e41_c0c3_a0fb70fe6d8c -->|calls| 9be33b96_22b1_5673_9a2d_308c712e297b
  43a2ca8a_a489_851f_99e3_e742b53e3ddb["testSSLExceptionJDKTLSv13()"]
  43a2ca8a_a489_851f_99e3_e742b53e3ddb -->|calls| 9be33b96_22b1_5673_9a2d_308c712e297b
  a8136434_be4c_e0dc_6e2e_2efbaeb9f660["channelInactive()"]
  9be33b96_22b1_5673_9a2d_308c712e297b -->|calls| a8136434_be4c_e0dc_6e2e_2efbaeb9f660
  style 9be33b96_22b1_5673_9a2d_308c712e297b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java lines 377–518

    private void testSslException(SslProvider provider, final boolean tlsv13) throws Exception {
        assumeTrue(SslProvider.isAlpnSupported(provider));
        if (tlsv13) {
            assumeTrue(SslProvider.isTlsv13Supported(provider));
        }
        final String protocol = tlsv13 ? "TLSv1.3" : "TLSv1.2";
        X509Bundle cert = new CertificateBuilder()
                .subject("cn=localhost")
                .setIsCertificateAuthority(true)
                .buildSelfSigned();
        final SslContext sslCtx = SslContextBuilder.forServer(cert.getKeyPair().getPrivate(), cert.getCertificatePath())
                .trustManager(new X509TrustManager() {
                    @Override
                    public void checkClientTrusted(X509Certificate[] chain, String authType)
                            throws CertificateException {
                        throw new CertificateExpiredException();
                    }

                    @Override
                    public void checkServerTrusted(X509Certificate[] chain, String authType)
                            throws CertificateException {
                        throw new CertificateExpiredException();
                    }

                    @Override
                    public X509Certificate[] getAcceptedIssuers() {
                        return new X509Certificate[0];
                    }
                }).sslProvider(provider)
                .ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE)
                .protocols(protocol)
                .applicationProtocolConfig(new ApplicationProtocolConfig(
                        ApplicationProtocolConfig.Protocol.ALPN,
                        // NO_ADVERTISE is currently the only mode supported by both OpenSsl and JDK providers.
                        ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE,
                        // ACCEPT is currently the only mode supported by both OpenSsl and JDK providers.
                        ApplicationProtocolConfig.SelectedListenerFailureBehavior.ACCEPT,
                        ApplicationProtocolNames.HTTP_2,
                        ApplicationProtocolNames.HTTP_1_1)).clientAuth(ClientAuth.REQUIRE)
                .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(sslCtx.newHandler(ch.alloc()));
                ch.pipeline().addLast(new Http2FrameCodecBuilder(true).build());
                ch.pipeline().addLast(new Http2MultiplexHandler(DISCARD_HANDLER));
            }
        });
        serverChannel = sb.bind(new InetSocketAddress(NetUtil.LOCALHOST, 0)).syncUninterruptibly().channel();

        final SslContext clientCtx = SslContextBuilder.forClient()
                .keyManager(cert.getKeyPair().getPrivate(), cert.getCertificatePath())
                .sslProvider(provider)
                /* NOTE: the cipher filter may not include all ciphers required by the HTTP/2 specification.
                 * Please refer to the HTTP/2 specification for cipher requirements. */
                .ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE)
                .trustManager(InsecureTrustManagerFactory.INSTANCE)
                .protocols(protocol)
                .applicationProtocolConfig(new ApplicationProtocolConfig(
                        ApplicationProtocolConfig.Protocol.ALPN,
                        // NO_ADVERTISE is currently the only mode supported by both OpenSsl and JDK providers.
                        ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE,
                        // ACCEPT is currently the only mode supported by both OpenSsl and JDK providers.
                        ApplicationProtocolConfig.SelectedListenerFailureBehavior.ACCEPT,
                        ApplicationProtocolNames.HTTP_2,
                        ApplicationProtocolNames.HTTP_1_1))
                .build();

        final CountDownLatch latch = new CountDownLatch(2);
        final AtomicReference<AssertionError> errorRef = new AtomicReference<AssertionError>();
        Bootstrap bs = new Bootstrap();
        bs.group(eventLoopGroup);
        bs.channel(NioSocketChannel.class);
        bs.handler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) {

Domain

Subdomains

Frequently Asked Questions

What does testSslException() do?
testSslException() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java.
Where is testSslException() defined?
testSslException() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java at line 377.
What does testSslException() call?
testSslException() calls 1 function(s): channelInactive.
What calls testSslException()?
testSslException() is called by 4 function(s): testSSLExceptionJDKTLSv12, testSSLExceptionJDKTLSv13, testSSLExceptionOpenSslTLSv12, testSSLExceptionOpenSslTLSv13.

Analyze Your Own Codebase

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

Try Supermodel Free