diff --git a/src/main/java/com/baidu/hugegraph/rest/RestClient.java b/src/main/java/com/baidu/hugegraph/rest/RestClient.java index 1171f539b..57e0a8b5f 100644 --- a/src/main/java/com/baidu/hugegraph/rest/RestClient.java +++ b/src/main/java/com/baidu/hugegraph/rest/RestClient.java @@ -19,24 +19,8 @@ package com.baidu.hugegraph.rest; -import static org.glassfish.jersey.apache.connector.ApacheClientProperties.CONNECTION_MANAGER; - -import java.util.Collection; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation.Builder; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Variant; - +import com.baidu.hugegraph.util.ExecutorUtil; +import com.google.common.collect.ImmutableMap; import org.apache.commons.lang3.tuple.Pair; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.pool.PoolStats; @@ -50,17 +34,26 @@ import org.glassfish.jersey.message.GZipEncoder; import org.glassfish.jersey.uri.UriComponent; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLSession; -import javax.net.ssl.TrustManager; -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.SSLContext; +import javax.net.ssl.*; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation.Builder; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Variant; import java.security.KeyManagementException; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; +import java.util.Collection; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; -import com.baidu.hugegraph.util.ExecutorUtil; -import com.google.common.collect.ImmutableMap; +import static org.glassfish.jersey.apache.connector.ApacheClientProperties.CONNECTION_MANAGER; @@ -138,8 +131,10 @@ public X509Certificate[] getAcceptedIssuers() { private Client wrapTrustConfig(String url, ClientConfig config) { Client client = null; SslConfigurator sslConfig = SslConfigurator.newInstance(); - sslConfig.trustStoreFile(config.getProperties().get("trustStoreFile").toString()) - .trustStorePassword(config.getProperties().get("trustStorePassword").toString()); + String trustStoreFile = config.getProperty("trustStoreFile").toString(); + String trustStorePassword = config.getProperty("trustStorePassword").toString(); + sslConfig.trustStoreFile(trustStoreFile) + .trustStorePassword(trustStorePassword); sslConfig.securityProtocol("SSL"); SSLContext sc = sslConfig.createSSLContext(); TrustManager[] trustAllCerts = NoCheckTrustManager(); @@ -157,7 +152,7 @@ private Client wrapTrustConfig(String url, ClientConfig config) { public RestClient(String url, ClientConfig config) { Client client = null; - Object protocol = config.getProperties().get("protocol"); + Object protocol = config.getProperty("protocol"); if (protocol != null && protocol.equals("https")) { client = wrapTrustConfig(url, config); } else { diff --git a/src/test/resources/hugegraph-evaluation.license b/src/test/resources/hugegraph-evaluation.license new file mode 100644 index 000000000..d09b0b930 Binary files /dev/null and b/src/test/resources/hugegraph-evaluation.license differ