0

Using protocol Http2 and trying to disable the hostname verification
But this didn't work for me

return HttpClient.create()
                .secure(sslContextSpec ->
                    sslContextSpec.sslContext(createSslContext(pcfSmpcClientProperties))
                        .handlerConfigurator(
                            (handler)->{
                                SSLEngine engine = handler.engine();
                                //engine.setNeedClientAuth(true);
                                SSLParameters params = new SSLParameters();
                                List<SNIMatcher> matchers = new LinkedList<>();
                                SNIMatcher matcher = new SNIMatcher(0) {
    
                                    @Override
                                    public boolean matches(SNIServerName serverName) {
                                        return true;
                                    }
                                };
                                matchers.add(matcher);
                                params.setSNIMatchers(matchers);
                                engine.setSSLParameters(params);
                            }
                        )
                )
                .wiretap(true)
                .protocol(HttpProtocol.H2)
                .compress(true)
                .followRedirect(true)
Cork Kochi
  • 1,783
  • 6
  • 29
  • 45

1 Answers1

0

You are trying to supress the Server name indicator [SNI] and what you are lookin is to skip HostName verification. In-order to achieve it you can set the endpointIdentificationAlgorithm either null or "", based on your JDK version.

SSLEngine engine = handler.engine();
SSLParameters params = new SSLParameters();
params.setEndpointIdentificationAlgorithm("");
engine.setSSLParameters(params);