Certificate for doesn't match any of the subject alternative names:[ドメイン名]

1227 ワード

static {
    SSLContext sslContext = null;
    try {
        sslContext = SSLContextBuilder.create().loadTrustMaterial(TrustAllStrategy.INSTANCE).build();
    } catch (Exception e) {
        e.printStackTrace();
    }
    Registry registry = RegistryBuilder.create()
            .register("http", PlainConnectionSocketFactory.INSTANCE)
            .register("https", new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE ))
            .build();
    connectionManager = new PoolingHttpClientConnectionManager(registry);
   // connectionManager.setMaxTotal(MAX_TOTAL);
   // connectionManager.setDefaultMaxPerRoute(10);
   // connectionManager.setValidateAfterInactivity(10);

    RequestConfig.Builder builder = RequestConfig.custom();
   // builder.setConnectTimeout(MAX_TIMEOUT);
   // builder.setSocketTimeout(MAX_TIMEOUT);
   // builder.setConnectionRequestTimeout(MAX_TIMEOUT);
    requestConfig = builder.build();
    httpClientBuilder = HttpClients.custom().setConnectionManager(connectionManager)
            .setDefaultRequestConfig(requestConfig);
}