SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(
null,
new TrustManager[]{TrustManagerUtils.getValidateServerCertificateTrustManager()},
new SecureRandom());
DefaultClientConfig config = new DefaultClientConfig();
config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
new HTTPSProperties(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession sslSession) {
return true;
}
}, sslContext));
Client client = Client.create(config);
this.service = client.resource(UriBuilder.fromUri(BASE_URL).build());
} catch (Exception e) {
throw new FalconRuntimException(e);
}
try {
String baseUrl = BASE_URL;
if (!baseUrl.endsWith("/")) {
baseUrl += "/";
}
this.authenticationToken = FalconClient.getToken(baseUrl);
} catch (FalconCLIException e) {
throw new AuthenticationException(e);
}
ClientConfig config = new DefaultClientConfig();
Client client = Client.create(config);
client.setReadTimeout(500000);
client.setConnectTimeout(500000);
this.service = client.resource(UriBuilder.fromUri(BASE_URL).build());
}