I'm using CXF to develop REST web services. I have an apache who accept SSL connection using certificate.
I want to test my code with org.apache.cxf.jaxrs.client.WebClient
class, but I can't communicate with apache because of:
javax.net.ssl.SSLException: java.lang.IllegalArgumentException:
SSLv2Hello cannot be enabled unless at least one other supported
version is also enabled.
I tried to configure HttpConduit like this:
TLSClientParameters tlsParams = new TLSClientParameters();
KeyStore trustStore = KeyStore.getInstance(KEYSTORE_TYPE);
InputStream inputStream = WesRctAbstractTestcase.class.getClassLoader().getResourceAsStream(KEYSTORE_PATH);
trustStore.load(inputStream, KEYSTORE_PASSWORD.toCharArray());
TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustFactory.init(trustStore);
TrustManager[] tms = trustFactory.getTrustManagers();
tlsParams.setTrustManagers(tms);
tlsParams.setSecureSocketProtocol("SSL");
tlsParams.setDisableCNCheck(true);
httpConduit.setTlsClientParameters(tlsParams);
I don't understand what is missing.