public static SSLConnectionSocketFactory trust()

in src/main/java/com/vmware/vim25/ws/ApacheTrustSelfSigned.java [34:64]


    public static SSLConnectionSocketFactory trust() {
        SSLContextBuilder builder = new SSLContextBuilder();
        log.trace("Set SSL Context Builder to trust self signed certs.");
        try {
            builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
            log.trace("Added Self Signed Strategy to builder.");
        }
        catch (NoSuchAlgorithmException e) {
            log.error("NoSuchAlgorithm caught trying to add SelfSignedStrategy.", e);
            return null;
        }
        catch (KeyStoreException e) {
            log.error("KeyStoreException caught trying to add TrustSelfSignedStrategy.", e);
            return null;
        }
        SSLConnectionSocketFactory sslConnectionSocketFactory;
        try {
            sslConnectionSocketFactory = new SSLConnectionSocketFactory(builder.build(), new AllowAllHostnameVerifier());
            log.trace("Added SSLConnectionSocketFactory to builder.");
        }
        catch (NoSuchAlgorithmException e) {
            log.error("Error trying to trust self signed certs.", e);
            return null;
        }
        catch (KeyManagementException e) {
            log.error("Error trying to trust self signed certs.", e);
            return null;
        }
        log.trace("Created self signed trust.");
        return sslConnectionSocketFactory;
    }