static private SecurityContext makeSecurityContext(String user, String password, Authentication type, SSLContext context, SSLHostnameVerifier verifier) { if ( Authentication.BASIC == type ) { return new BasicAuthContext(user, password) .withSSLContext(context) .withSSLHostnameVerifier(verifier); } else if ( Authentication.DIGEST == type ) { return new DigestAuthContext(user, password) .withSSLContext(context) .withSSLHostnameVerifier(verifier); } else { throw new IllegalStateException("makeSecurityContext should only be called with BASIC or DIGEST Authentication"); } }
}}).withSSLHostnameVerifier(SSLHostnameVerifier.ANY); DatabaseClient client = DatabaseClientFactory.newClient(appServerHostname, 8012, secContext, getConnType());
}}).withSSLHostnameVerifier(SSLHostnameVerifier.ANY); DatabaseClient client = DatabaseClientFactory.newClient(appServerHostname, 8033, secContext, getConnType());
}}).withSSLHostnameVerifier(SSLHostnameVerifier.ANY); DatabaseClient client = DatabaseClientFactory.newClient(appServerHostname, 8011, secContext, getConnType());
switch (authMethod) { case DIGEST: return DatabaseClientFactory.newClient(host, port, dbName, new DatabaseClientFactory.DigestAuthContext(user, password) .withSSLHostnameVerifier(SSLHostnameVerifier.ANY) .withSSLContext(SimpleX509TrustManager.newSSLContext(), new SimpleX509TrustManager()), DatabaseClient.ConnectionType.GATEWAY); switch (authMethod) { case DIGEST: return DatabaseClientFactory.newClient(host, port, dbName, new DatabaseClientFactory.DigestAuthContext(user, password) .withSSLHostnameVerifier(SSLHostnameVerifier.ANY) .withSSLContext(SimpleX509TrustManager.newSSLContext(), new SimpleX509TrustManager())); case BASIC: return DatabaseClientFactory.newClient(host, port, dbName, new DatabaseClientFactory.BasicAuthContext(user, password)
.withSSLHostnameVerifier(SSLHostnameVerifier.ANY));