Examples of BasicHttpClientConnectionManager


Examples of org.apache.http.impl.conn.BasicHttpClientConnectionManager

 
  @Test 
  public void testServerErrors() throws Exception {
    // tests the behaviour of the client when the server sends an error
    // must use BasicClientConnectionManager to test whether the client is closed correctly
    BasicHttpClientConnectionManager conMgr = new BasicHttpClientConnectionManager();
    Replicator replicator = new HttpReplicator(host, port, ReplicationService.REPLICATION_CONTEXT + "/s1", conMgr);
    ReplicationClient client = new ReplicationClient(replicator, new IndexReplicationHandler(handlerIndexDir, null),
        new PerSessionDirectoryFactory(clientWorkDir));
   
    try {
View Full Code Here

Examples of org.apache.http.impl.conn.BasicHttpClientConnectionManager

        this.localServer = new LocalTestServer(null, null);
        this.localServer.registerDefaultHandlers();
        this.localServer.start();

        this.httpclient = HttpClients.custom()
                .setConnectionManager(new BasicHttpClientConnectionManager())
                .build();
    }
View Full Code Here

Examples of org.apache.http.impl.conn.BasicHttpClientConnectionManager

public class TestBasicConnectionManager extends LocalServerTestBase {

    @Test
    public void testBasics() throws Exception {
        this.clientBuilder.setConnectionManager(new BasicHttpClientConnectionManager());

        final HttpHost target = start();
        final HttpGet get = new HttpGet("/random/1024");
        final CloseableHttpResponse response = this.httpclient.execute(target, get);
        try {
View Full Code Here

Examples of org.apache.http.impl.conn.BasicHttpClientConnectionManager

        }
    }

    @Test(expected=IllegalStateException.class)
    public void testConnectionStillInUse() throws Exception {
        this.clientBuilder.setConnectionManager(new BasicHttpClientConnectionManager());

        final HttpHost target = start();
        final HttpGet get1 = new HttpGet("/random/1024");
        this.httpclient.execute(target, get1);
        final HttpGet get2 = new HttpGet("/random/1024");
View Full Code Here

Examples of org.apache.http.impl.conn.BasicHttpClientConnectionManager

      final Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
          .register("http", PlainConnectionSocketFactory.getSocketFactory())
          .register("https", sslSocketFactory).build();

      httpClientBuilder = httpClientFactory.prepare(new RemoteStorageContextCustomizer(context));
      connectionManager = new BasicHttpClientConnectionManager(registry);
      httpClientBuilder.getHttpClientBuilder().setConnectionManager(connectionManager);
      httpClientBuilder.getHttpClientBuilder().addInterceptorFirst(
          new HttpResponseInterceptor()
          {
            @Override
View Full Code Here

Examples of org.apache.http.impl.conn.BasicHttpClientConnectionManager

                        cconfig.getMessageConstraints(), null, null,
                        DefaultHttpRequestWriterFactory.INSTANCE,
                        DefaultHttpResponseParserFactory.INSTANCE);
            }
        };
        BasicHttpClientConnectionManager connMan = new BasicHttpClientConnectionManager(
                socketFactoryRegistry, connFactory, null, dnsResolver);
       
        SocketConfig.Builder socketConfigBuilder = SocketConfig.custom();
        socketConfigBuilder.setSoTimeout(fetcher.getSoTimeoutMs());
        connMan.setSocketConfig(socketConfigBuilder.build());
       
        return connMan;
    }
View Full Code Here

Examples of org.apache.http.impl.conn.BasicHttpClientConnectionManager

  private synchronized HttpClient getHttpClient () throws KeyManagementException, NoSuchAlgorithmException
  {
    if (httpClient == null)
    {
      HttpClientConnectionManager cm = new BasicHttpClientConnectionManager();
      RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(60).setConnectionRequestTimeout(60).build();
      httpClient = HttpClientBuilder.create().setConnectionManager(cm).setDefaultRequestConfig(requestConfig).build();
    }

    return httpClient;
View Full Code Here

Examples of org.apache.http.impl.conn.BasicHttpClientConnectionManager

    private HttpClient httpClient;

    public PageManagerImpl() {
        httpClient = HttpClientBuilder
                .create()
                .setConnectionManager(new BasicHttpClientConnectionManager())
                .build();
    }
View Full Code Here

Examples of org.apache.http.impl.conn.BasicHttpClientConnectionManager

            builder.setSSLSocketFactory(scsf);
            Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
                    .register("https", scsf)
                    .build();

            HttpClientConnectionManager ccm = new BasicHttpClientConnectionManager(registry);

            builder.setConnectionManager(ccm);
            return builder.build();
        } catch (Exception ex) {
            ex.printStackTrace();
View Full Code Here

Examples of org.apache.http.impl.conn.BasicHttpClientConnectionManager

    // tests - configs

    @Test
    public final void givenHttpClientIsConfiguredWithCustomConnectionManager_whenExecutingRequest_thenNoExceptions() throws ClientProtocolException, IOException {
        instance = HttpClientBuilder.create().setConnectionManager(new BasicHttpClientConnectionManager()).build();
        response = instance.execute(new HttpGet(SAMPLE_URL));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.