Search in sources :

Example 11 with Registry

use of org.apache.http.config.Registry in project questdb by bluestreak01.

the class HttpServerTest method createHttpClient_AcceptsUntrustedCerts.

private static HttpClientBuilder createHttpClient_AcceptsUntrustedCerts() throws Exception {
    HttpClientBuilder b = HttpClientBuilder.create();
    // setup a Trust Strategy that allows all certificates.
    // 
    SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, (arg0, arg1) -> true).build();
    b.setSSLContext(sslContext);
    // here's the special part:
    // -- need to create an SSL Socket Factory, to use our weakened "trust strategy";
    // -- and create a Registry, to register it.
    // 
    SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(sslContext, (s, sslSession) -> true);
    Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("http", PlainConnectionSocketFactory.getSocketFactory()).register("https", sslSocketFactory).build();
    // now, we create connection-manager using our Registry.
    // -- allows multi-threaded use
    b.setConnectionManager(new PoolingHttpClientConnectionManager(socketFactoryRegistry));
    return b;
}
Also used : HttpPost(org.apache.http.client.methods.HttpPost) SSLContext(javax.net.ssl.SSLContext) DateFormatUtils(com.questdb.std.time.DateFormatUtils) BootstrapEnv(com.questdb.BootstrapEnv) JournalEntryWriter(com.questdb.store.JournalEntryWriter) StaticContentHandler(com.questdb.net.http.handlers.StaticContentHandler) Header(org.apache.http.Header) ByteBuffer(java.nio.ByteBuffer) Registry(org.apache.http.config.Registry) SocketChannel(java.nio.channels.SocketChannel) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) PoolingHttpClientConnectionManager(org.apache.http.impl.conn.PoolingHttpClientConnectionManager) Journal(com.questdb.store.Journal) SSLConnectionSocketFactory(org.apache.http.conn.ssl.SSLConnectionSocketFactory) TestUtils(com.questdb.test.tools.TestUtils) StandardSocketOptions(java.net.StandardSocketOptions) RecordSourcePrinter(com.questdb.ql.RecordSourcePrinter) AbstractJournalTest(com.questdb.net.ha.AbstractJournalTest) CyclicBarrier(java.util.concurrent.CyclicBarrier) ImportHandler(com.questdb.net.http.handlers.ImportHandler) MultipartEntityBuilder(org.apache.http.entity.mime.MultipartEntityBuilder) FileSink(com.questdb.std.str.FileSink) InetSocketAddress(java.net.InetSocketAddress) DateLocaleFactory(com.questdb.std.time.DateLocaleFactory) StringSink(com.questdb.std.str.StringSink) LockSupport(java.util.concurrent.locks.LockSupport) CountDownLatch(java.util.concurrent.CountDownLatch) HttpGet(org.apache.http.client.methods.HttpGet) ConnectionSocketFactory(org.apache.http.conn.socket.ConnectionSocketFactory) ResponseContentBufferTooSmallException(com.questdb.ex.ResponseContentBufferTooSmallException) Misc(com.questdb.std.Misc) HttpClients(org.apache.http.impl.client.HttpClients) Socket(java.net.Socket) RegistryBuilder(org.apache.http.config.RegistryBuilder) JournalStructure(com.questdb.store.factory.configuration.JournalStructure) HttpTestUtils(com.questdb.test.tools.HttpTestUtils) ByteBuffers(com.questdb.std.ByteBuffers) LogFactory(com.questdb.log.LogFactory) QueryCompiler(com.questdb.parser.sql.QueryCompiler) SocketException(java.net.SocketException) Log(com.questdb.log.Log) CloseableHttpResponse(org.apache.http.client.methods.CloseableHttpResponse) PlainConnectionSocketFactory(org.apache.http.conn.socket.PlainConnectionSocketFactory) ServerConfiguration(com.questdb.ServerConfiguration) RecordSource(com.questdb.ql.RecordSource) TypeProbeCollection(com.questdb.parser.typeprobe.TypeProbeCollection) FileBody(org.apache.http.entity.mime.content.FileBody) CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) JournalWriter(com.questdb.store.JournalWriter) DateFormatFactory(com.questdb.std.time.DateFormatFactory) Test(org.junit.Test) SSLContextBuilder(org.apache.http.ssl.SSLContextBuilder) ColumnType(com.questdb.common.ColumnType) Chars(com.questdb.std.Chars) Rule(org.junit.Rule) WriterFactory(com.questdb.store.factory.WriterFactory) Ignore(org.junit.Ignore) java.io(java.io) FactoryEventListener(com.questdb.store.factory.FactoryEventListener) HttpResponse(org.apache.http.HttpResponse) Numbers(com.questdb.std.Numbers) HttpClientBuilder(org.apache.http.impl.client.HttpClientBuilder) Assert(org.junit.Assert) TemporaryFolder(org.junit.rules.TemporaryFolder) UploadHandler(com.questdb.net.http.handlers.UploadHandler) SSLConnectionSocketFactory(org.apache.http.conn.ssl.SSLConnectionSocketFactory) ConnectionSocketFactory(org.apache.http.conn.socket.ConnectionSocketFactory) PlainConnectionSocketFactory(org.apache.http.conn.socket.PlainConnectionSocketFactory) HttpClientBuilder(org.apache.http.impl.client.HttpClientBuilder) SSLContext(javax.net.ssl.SSLContext) SSLContextBuilder(org.apache.http.ssl.SSLContextBuilder) SSLConnectionSocketFactory(org.apache.http.conn.ssl.SSLConnectionSocketFactory) PoolingHttpClientConnectionManager(org.apache.http.impl.conn.PoolingHttpClientConnectionManager)

Example 12 with Registry

use of org.apache.http.config.Registry in project yorc-a4c-plugin by ystia.

the class RestClient method setProviderConfiguration.

public void setProviderConfiguration(ProviderConfig providerConfiguration) throws PluginConfigurationException {
    this.providerConfiguration = providerConfiguration;
    log.debug("setProviderConfiguration YorcURL=" + providerConfiguration.getUrlYorc());
    RequestConfig clientConfig = RequestConfig.custom().setConnectTimeout(((Long) CONNECTION_TIMEOUT).intValue()).setSocketTimeout(((Long) SOCKET_TIMEOUT).intValue()).setConnectionRequestTimeout(((Long) SOCKET_TIMEOUT).intValue()).build();
    CloseableHttpClient httpClient;
    if (Boolean.TRUE.equals(providerConfiguration.getInsecureTLS())) {
        SSLContext sslContext;
        try {
            sslContext = SSLContexts.custom().loadTrustMaterial(null, (chain, authType) -> true).build();
        } catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) {
            e.printStackTrace();
            throw new PluginConfigurationException("Failed to create SSL socket factory", e);
        }
        SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new AllowAllHostnameVerifier());
        Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("https", sslsf).build();
        PoolingHttpClientConnectionManager poolHttpConnManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
        configurePoolingHttpClientConnectionManager(poolHttpConnManager);
        httpClient = HttpClientBuilder.create().useSystemProperties().setConnectionManager(poolHttpConnManager).setDefaultRequestConfig(clientConfig).setSslcontext(sslContext).build();
    } else if (providerConfiguration.getUrlYorc().startsWith("https")) {
        SSLContext sslContext;
        // on system default keystore and truststore
        if (providerConfiguration.getCaCertificate().isEmpty() || providerConfiguration.getClientCertificate().isEmpty() || providerConfiguration.getClientKey().isEmpty()) {
            log.warn("Missing CA|Client certificate|Client key in plugin configuration, will use system defaults");
            if (System.getProperty("javax.net.ssl.keyStore") == null || System.getProperty("javax.net.ssl.keyStorePassword") == null) {
                log.warn("Using SSL but you didn't provide client keystore and password. This means that if required by Yorc client authentication will fail.\n" + "Please use -Djavax.net.ssl.keyStore <keyStorePath> -Djavax.net.ssl.keyStorePassword <password> while starting java VM");
            }
            if (System.getProperty("javax.net.ssl.trustStore") == null || System.getProperty("javax.net.ssl.trustStorePassword") == null) {
                log.warn("You didn't provide client trustore and password. Using defalut one \n" + "Please use -Djavax.net.ssl.trustStore <trustStorePath> -Djavax.net.ssl.trustStorePassword <password> while starting java VM");
            }
            sslContext = SSLContexts.createSystemDefault();
        } else {
            // Create a key store containing CA and client key/certificate provided
            // in the plugin configuration
            KeyStore keystore;
            try {
                // Create the CA certificate from its configuration string value
                CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
                ByteArrayInputStream inputStream = new ByteArrayInputStream(providerConfiguration.getCaCertificate().getBytes());
                X509Certificate trustedCert = (X509Certificate) certFactory.generateCertificate(inputStream);
                inputStream.close();
                // Create the client private key from its configuration string value
                String keyContent = providerConfiguration.getClientKey().replaceFirst("-----BEGIN PRIVATE KEY-----\n", "").replaceFirst("\n-----END PRIVATE KEY-----", "").trim();
                PKCS8EncodedKeySpec clientKeySpec = new PKCS8EncodedKeySpec(Base64.getMimeDecoder().decode(keyContent));
                // Getting the key algorithm
                ASN1InputStream bIn = new ASN1InputStream(new ByteArrayInputStream(clientKeySpec.getEncoded()));
                PrivateKeyInfo pki = PrivateKeyInfo.getInstance(bIn.readObject());
                bIn.close();
                String algorithm = pki.getPrivateKeyAlgorithm().getAlgorithm().getId();
                // Workaround for a missing algorithm OID in the list of default providers
                if ("1.2.840.113549.1.1.1".equals(algorithm)) {
                    algorithm = "RSA";
                }
                KeyFactory keyFactory = KeyFactory.getInstance(algorithm);
                PrivateKey clientKey = keyFactory.generatePrivate(clientKeySpec);
                // Create the client certificate from its configuration string value
                inputStream = new ByteArrayInputStream(providerConfiguration.getClientCertificate().getBytes());
                Certificate clientCert = certFactory.generateCertificate(inputStream);
                inputStream.close();
                // Create an empty keystore
                keystore = KeyStore.getInstance(KeyStore.getDefaultType());
                keystore.load(null);
                // Add the certificate authority
                keystore.setCertificateEntry(trustedCert.getSubjectX500Principal().getName(), trustedCert);
                // Add client key/certificate and chain to the Key store
                Certificate[] chain = { clientCert, trustedCert };
                keystore.setKeyEntry("Yorc Client", clientKey, "yorc".toCharArray(), chain);
            } catch (CertificateException | IOException | NoSuchAlgorithmException | InvalidKeySpecException | KeyStoreException e) {
                e.printStackTrace();
                throw new PluginConfigurationException("Failed to create keystore", e);
            }
            // Create a SSL context using this Key Store
            try {
                TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
                tmf.init(keystore);
                sslContext = SSLContext.getInstance("TLS");
                KeyManagerFactory kmf = KeyManagerFactory.getInstance("NewSunX509");
                kmf.init(keystore, "yorc".toCharArray());
                sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
            } catch (NoSuchAlgorithmException | KeyStoreException | UnrecoverableKeyException | KeyManagementException e) {
                e.printStackTrace();
                throw new PluginConfigurationException("Failed to create SSL context", e);
            }
        }
        SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext);
        Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("https", sslsf).build();
        PoolingHttpClientConnectionManager poolHttpConnManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
        configurePoolingHttpClientConnectionManager(poolHttpConnManager);
        httpClient = HttpClientBuilder.create().useSystemProperties().setConnectionManager(poolHttpConnManager).setDefaultRequestConfig(clientConfig).setSslcontext(sslContext).build();
    } else {
        PoolingHttpClientConnectionManager poolHttpConnManager = new PoolingHttpClientConnectionManager();
        configurePoolingHttpClientConnectionManager(poolHttpConnManager);
        httpClient = HttpClientBuilder.create().useSystemProperties().setConnectionManager(poolHttpConnManager).setDefaultRequestConfig(clientConfig).build();
    }
    // Instantiate restTemplate
    HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
    restTemplate = new RestTemplate(requestFactory);
    // Display deployments
    try {
        logDeployments();
    } catch (Exception e) {
        log.warn("Unable to retrieve deployments due to: {}", e.getMessage());
        e.printStackTrace();
        throw new PluginConfigurationException("Failed to connect to yorc", e);
    }
}
Also used : PrivateKey(java.security.PrivateKey) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) SSLConnectionSocketFactory(org.apache.http.conn.ssl.SSLConnectionSocketFactory) CertificateFactory(java.security.cert.CertificateFactory) KeyManagementException(java.security.KeyManagementException) SSLConnectionSocketFactory(org.apache.http.conn.ssl.SSLConnectionSocketFactory) ConnectionSocketFactory(org.apache.http.conn.socket.ConnectionSocketFactory) HttpComponentsClientHttpRequestFactory(org.springframework.http.client.HttpComponentsClientHttpRequestFactory) KeyFactory(java.security.KeyFactory) RequestConfig(org.apache.http.client.config.RequestConfig) CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) ASN1InputStream(org.bouncycastle.asn1.ASN1InputStream) AllowAllHostnameVerifier(org.apache.http.conn.ssl.AllowAllHostnameVerifier) SSLContext(javax.net.ssl.SSLContext) KeyStoreException(java.security.KeyStoreException) PluginConfigurationException(alien4cloud.paas.exception.PluginConfigurationException) Registry(org.apache.http.config.Registry) KeyStore(java.security.KeyStore) X509Certificate(java.security.cert.X509Certificate) InvalidKeySpecException(java.security.spec.InvalidKeySpecException) HttpStatusCodeException(org.springframework.web.client.HttpStatusCodeException) KeyStoreException(java.security.KeyStoreException) UnrecoverableKeyException(java.security.UnrecoverableKeyException) RestClientException(org.springframework.web.client.RestClientException) IOException(java.io.IOException) KeyManagementException(java.security.KeyManagementException) CertificateException(java.security.cert.CertificateException) PluginConfigurationException(alien4cloud.paas.exception.PluginConfigurationException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) PoolingHttpClientConnectionManager(org.apache.http.impl.conn.PoolingHttpClientConnectionManager) KeyManagerFactory(javax.net.ssl.KeyManagerFactory) ByteArrayInputStream(java.io.ByteArrayInputStream) PKCS8EncodedKeySpec(java.security.spec.PKCS8EncodedKeySpec) TrustManagerFactory(javax.net.ssl.TrustManagerFactory) RestTemplate(org.springframework.web.client.RestTemplate) PrivateKeyInfo(org.bouncycastle.asn1.pkcs.PrivateKeyInfo) X509Certificate(java.security.cert.X509Certificate) Certificate(java.security.cert.Certificate)

Example 13 with Registry

use of org.apache.http.config.Registry in project ats-framework by Axway.

the class RestClient method constructApacheConnectorInvocationBuilder.

private void constructApacheConnectorInvocationBuilder(String descriptionToken, boolean suppressHttpComplianceValidation) {
    // create the client config object
    ClientConfig clientConfig = createClientConfig(suppressHttpComplianceValidation);
    // check if user had specified custom connection manager and custom connection factory
    boolean hasConnectionManager = this.clientConfigurator.getConnectionManager() != null;
    boolean hasConnectionFactory = this.clientConfigurator.getConnectionFactory() != null;
    // handle HTTPS requests
    Registry registry = null;
    if (isHttps()) {
        // configure Trust-all SSL context
        if (!hasConnectionManager) {
        }
        registry = constructRegistry();
    }
    HttpClientConnectionManager connectionManager = null;
    HttpConnectionFactory connectionFactory = null;
    if (hasConnectionManager) {
        connectionManager = this.clientConfigurator.getConnectionManager();
        if (hasConnectionFactory) {
            connectionFactory = this.clientConfigurator.getConnectionFactory();
        } else {
            throw new RuntimeException("Connection manager was specified, but connection factory was not. " + "Provide both if you want to use custom connection manager");
        }
    } else {
        if (hasConnectionFactory) {
            connectionFactory = this.clientConfigurator.getConnectionFactory();
        } else {
            connectionFactory = new ManagedHttpClientConnectionFactory();
        }
        if (registry != null) {
            if (usePooling) {
                connectionManager = new PoolingHttpClientConnectionManager(registry, connectionFactory);
            } else {
                connectionManager = new BasicHttpClientConnectionManager(registry, connectionFactory);
            }
        } else {
            if (usePooling) {
                connectionManager = new PoolingHttpClientConnectionManager(connectionFactory);
            } else {
                connectionManager = new BasicHttpClientConnectionManager(RegistryBuilder.<ConnectionSocketFactory>create().register("http", PlainConnectionSocketFactory.getSocketFactory()).register("https", SSLConnectionSocketFactory.getSocketFactory()).build(), connectionFactory);
            }
        }
    }
    if (connectionManager != null && connectionManager instanceof PoolingHttpClientConnectionManager) {
        // 10 sec
        ((PoolingHttpClientConnectionManager) connectionManager).setValidateAfterInactivity(10 * 1000);
    }
    try {
        Class<?> apacheClientProperties = Class.forName(RestClient.APACHE_CLIENT_PROPERTIES_CLASSNAME);
        clientConfig.property((String) apacheClientProperties.getDeclaredField("CONNECTION_MANAGER").get(null), connectionManager);
    } catch (Exception e) {
        throw new RuntimeException("Could not set validity timeinterval for '" + connectionManager.getClass().getName() + "'", e);
    }
    // create the client builder
    ClientBuilder clientBuilder = ClientBuilder.newBuilder().withConfig(clientConfig);
    // now create the client
    createClient(clientBuilder);
    createInvocationBuilder(descriptionToken);
}
Also used : HttpConnectionFactory(org.apache.http.conn.HttpConnectionFactory) ManagedHttpClientConnectionFactory(org.apache.http.impl.conn.ManagedHttpClientConnectionFactory) Registry(org.apache.http.config.Registry) ClientConfig(org.glassfish.jersey.client.ClientConfig) PoolingHttpClientConnectionManager(org.apache.http.impl.conn.PoolingHttpClientConnectionManager) HttpClientConnectionManager(org.apache.http.conn.HttpClientConnectionManager) BasicHttpClientConnectionManager(org.apache.http.impl.conn.BasicHttpClientConnectionManager) BasicHttpClientConnectionManager(org.apache.http.impl.conn.BasicHttpClientConnectionManager) RestException(com.axway.ats.action.exceptions.RestException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) CertificateException(java.security.cert.CertificateException) PoolingHttpClientConnectionManager(org.apache.http.impl.conn.PoolingHttpClientConnectionManager) ClientBuilder(javax.ws.rs.client.ClientBuilder)

Example 14 with Registry

use of org.apache.http.config.Registry in project thingsboard by thingsboard.

the class AbstractContainerTest method getRequestFactoryForSelfSignedCert.

private static HttpComponentsClientHttpRequestFactory getRequestFactoryForSelfSignedCert() throws Exception {
    SSLContextBuilder builder = SSLContexts.custom();
    builder.loadTrustMaterial(null, (TrustStrategy) (chain, authType) -> true);
    SSLContext sslContext = builder.build();
    SSLConnectionSocketFactory sslSelfSigned = new SSLConnectionSocketFactory(sslContext, (s, sslSession) -> true);
    Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("https", sslSelfSigned).build();
    PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
    CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm).build();
    return new HttpComponentsClientHttpRequestFactory(httpClient);
}
Also used : X509Certificate(java.security.cert.X509Certificate) JsonObject(com.google.gson.JsonObject) SSLContext(javax.net.ssl.SSLContext) Json(org.apache.cassandra.cql3.Json) RegistryBuilder(org.apache.http.config.RegistryBuilder) BeforeClass(org.junit.BeforeClass) TestRule(org.junit.rules.TestRule) Device(org.thingsboard.server.common.data.Device) WsTelemetryResponse(org.thingsboard.server.msa.mapper.WsTelemetryResponse) SSLSocket(javax.net.ssl.SSLSocket) Random(java.util.Random) JsonParser(com.google.gson.JsonParser) Registry(org.apache.http.config.Registry) SSLSession(javax.net.ssl.SSLSession) X509HostnameVerifier(org.apache.http.conn.ssl.X509HostnameVerifier) RestClient(org.thingsboard.rest.client.RestClient) SSLContexts(org.apache.http.ssl.SSLContexts) Map(java.util.Map) PoolingHttpClientConnectionManager(org.apache.http.impl.conn.PoolingHttpClientConnectionManager) EntityType(org.thingsboard.server.common.data.EntityType) JsonNode(com.fasterxml.jackson.databind.JsonNode) URI(java.net.URI) HostnameVerifier(javax.net.ssl.HostnameVerifier) SSLConnectionSocketFactory(org.apache.http.conn.ssl.SSLConnectionSocketFactory) CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) DeviceId(org.thingsboard.server.common.data.id.DeviceId) ImmutableMap(com.google.common.collect.ImmutableMap) TrustStrategy(org.apache.http.conn.ssl.TrustStrategy) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DeviceCredentials(org.thingsboard.server.common.data.security.DeviceCredentials) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) Description(org.junit.runner.Description) SSLContextBuilder(org.apache.http.ssl.SSLContextBuilder) HttpComponentsClientHttpRequestFactory(org.springframework.http.client.HttpComponentsClientHttpRequestFactory) TestWatcher(org.junit.rules.TestWatcher) JsonArray(com.google.gson.JsonArray) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) JSONObject(org.json.simple.JSONObject) Rule(org.junit.Rule) ConnectionSocketFactory(org.apache.http.conn.socket.ConnectionSocketFactory) Optional(java.util.Optional) RandomStringUtils(org.apache.commons.lang3.RandomStringUtils) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) HttpClients(org.apache.http.impl.client.HttpClients) CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) SSLConnectionSocketFactory(org.apache.http.conn.ssl.SSLConnectionSocketFactory) ConnectionSocketFactory(org.apache.http.conn.socket.ConnectionSocketFactory) SSLContext(javax.net.ssl.SSLContext) HttpComponentsClientHttpRequestFactory(org.springframework.http.client.HttpComponentsClientHttpRequestFactory) SSLContextBuilder(org.apache.http.ssl.SSLContextBuilder) SSLConnectionSocketFactory(org.apache.http.conn.ssl.SSLConnectionSocketFactory) PoolingHttpClientConnectionManager(org.apache.http.impl.conn.PoolingHttpClientConnectionManager)

Aggregations

Registry (org.apache.http.config.Registry)14 SSLConnectionSocketFactory (org.apache.http.conn.ssl.SSLConnectionSocketFactory)12 SSLContext (javax.net.ssl.SSLContext)10 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)10 PoolingHttpClientConnectionManager (org.apache.http.impl.conn.PoolingHttpClientConnectionManager)10 ConnectionSocketFactory (org.apache.http.conn.socket.ConnectionSocketFactory)9 IOException (java.io.IOException)8 RegistryBuilder (org.apache.http.config.RegistryBuilder)8 HttpResponse (org.apache.http.HttpResponse)6 HttpGet (org.apache.http.client.methods.HttpGet)6 HttpClientBuilder (org.apache.http.impl.client.HttpClientBuilder)6 SSLContextBuilder (org.apache.http.ssl.SSLContextBuilder)6 URI (java.net.URI)5 HostnameVerifier (javax.net.ssl.HostnameVerifier)5 PlainConnectionSocketFactory (org.apache.http.conn.socket.PlainConnectionSocketFactory)5 KeyManagementException (java.security.KeyManagementException)4 KeyStoreException (java.security.KeyStoreException)4 RequestConfig (org.apache.http.client.config.RequestConfig)4 ProxySelector (java.net.ProxySelector)3 CertificateException (java.security.cert.CertificateException)3