public static synchronized SSLContext getTrustContext()

in src/main/java/com/vmware/vim25/ws/TrustAllSSL.java [30:54]


    public static synchronized SSLContext getTrustContext() throws RemoteException {
        try {
            if (getAlreadyCreated()) {
                return sslContext;
            }
            setAlreadyCreated();
            TrustManager[] trustAllCerts = new TrustManager[1];
            trustAllCerts[0] = new TrustAllManager();
            sslContext = SSLContext.getInstance("TLS");
            sslContext.init(null, trustAllCerts, new SecureRandom());
            HttpsURLConnection.setDefaultHostnameVerifier(
                new HostnameVerifier() {
                    public boolean verify(String urlHostName, SSLSession session) {
                        return true;
                    }
                }
            );
        } catch (NoSuchAlgorithmException e) {
            throw new RemoteException("Unable to find suitable algorithm while attempting to communicate with remote server.", e);
        } catch (KeyManagementException e) {
            throw new RemoteException("Key Management exception while attempting to communicate with remote server.", e);
        }

        return sslContext;
    }