Home / Function/ mySetupClientHostnameValidation() — netty Function Reference

mySetupClientHostnameValidation() — netty Function Reference

Architecture documentation for the mySetupClientHostnameValidation() function in HandlerSslTest.java from the netty codebase.

Function java Buffer Search called by 2

Entity Profile

Dependency Diagram

graph TD
  3ff16853_d45d_8579_bdfe_da4318b11ea1["mySetupClientHostnameValidation()"]
  7926397b_13a0_4e40_b752_60204eb56e1f["HandlerSslTest"]
  3ff16853_d45d_8579_bdfe_da4318b11ea1 -->|defined in| 7926397b_13a0_4e40_b752_60204eb56e1f
  756f701d_6aa1_6e66_abb7_87a36b0ea149["testSimpleJdkProvider()"]
  756f701d_6aa1_6e66_abb7_87a36b0ea149 -->|calls| 3ff16853_d45d_8579_bdfe_da4318b11ea1
  e96eb034_5910_32b1_6595_fe2a69fed664["testOpenSslProvider()"]
  e96eb034_5910_32b1_6595_fe2a69fed664 -->|calls| 3ff16853_d45d_8579_bdfe_da4318b11ea1
  style 3ff16853_d45d_8579_bdfe_da4318b11ea1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/HandlerSslTest.java lines 101–226

    private Future<Void> mySetupClientHostnameValidation(SslProvider sslProvider,
                                                         final boolean failureExpected)
            throws Exception {

        final String expectedHost = "localhost";
        SslContext serverSslCtx = forServer(signedCert.getKeyPair().getPrivate(), signedCert.getCertificatePath())
                .sslProvider(sslProvider)
                .trustManager(InsecureTrustManagerFactory.INSTANCE)
                .ciphers(null, IdentityCipherSuiteFilter.INSTANCE)
                .sessionCacheSize(0)
                .sessionTimeout(0)
                .build();

        SslContext clientSslCtx = forClient()
                .sslProvider(sslProvider)
                .trustManager(signedCert.toTrustManagerFactory())
                .ciphers(null, IdentityCipherSuiteFilter.INSTANCE)
                .sessionCacheSize(0)
                .sessionTimeout(0)
                .build();

        serverConnectedChannel = null;
        ServerBootstrap sb = new ServerBootstrap();
        Bootstrap cb = new Bootstrap();

        sb.group(new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory()));
        sb.channel(NioServerSocketChannel.class);
        sb.childHandler(new ChannelInitializer() {
            @Override
            protected void initChannel(Channel ch) throws Exception {
                ChannelPipeline p = ch.pipeline();

                SslHandler handler = serverSslCtx.newHandler(ch.alloc());
                p.addLast(handler);
                p.addLast(new ChannelInboundHandlerAdapter() {
                    @Override
                    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
                        if (evt == SslHandshakeCompletionEvent.SUCCESS) {
                            if (failureExpected) {
                                serverException = new IllegalStateException("handshake complete. expected failure");
                            }
                            serverLatch.countDown();
                        } else if (evt instanceof SslHandshakeCompletionEvent) {
                            serverException = ((SslHandshakeCompletionEvent) evt).cause();
                            serverLatch.countDown();
                        }
                        ctx.fireUserEventTriggered(evt);
                    }

                    @Override
                    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
                        if (cause.getCause() instanceof SSLHandshakeException) {
                            serverException = cause.getCause();
                            serverLatch.countDown();
                        } else {
                            serverException = cause;
                            ctx.fireExceptionCaught(cause);
                        }
                    }
                });
                serverConnectedChannel = ch;
            }
        });

        final Promise<Void> clientWritePromise = ImmediateEventExecutor.INSTANCE.newPromise();
        cb.group(new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory()));
        cb.channel(NioSocketChannel.class);
        cb.handler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) throws Exception {
                ChannelPipeline p = ch.pipeline();
                InetSocketAddress remoteAddress = (InetSocketAddress) serverChannel.localAddress();

                SslHandler sslHandler = clientSslCtx.newHandler(ch.alloc(), expectedHost, 0);

                SSLParameters parameters = sslHandler.engine().getSSLParameters();
                parameters.setEndpointIdentificationAlgorithm("HTTPS");
                sslHandler.engine().setSSLParameters(parameters);
                p.addLast(sslHandler);
                p.addLast(new ChannelInboundHandlerAdapter() {
                    @Override

Domain

Subdomains

Frequently Asked Questions

What does mySetupClientHostnameValidation() do?
mySetupClientHostnameValidation() is a function in the netty codebase, defined in testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/HandlerSslTest.java.
Where is mySetupClientHostnameValidation() defined?
mySetupClientHostnameValidation() is defined in testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/HandlerSslTest.java at line 101.
What calls mySetupClientHostnameValidation()?
mySetupClientHostnameValidation() is called by 2 function(s): testOpenSslProvider, testSimpleJdkProvider.

Analyze Your Own Codebase

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

Try Supermodel Free