Package org.apache.http.impl.nio.client

Examples of org.apache.http.impl.nio.client.CloseableHttpAsyncClient.start()


                SSLIOSessionStrategy.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
        CloseableHttpAsyncClient httpclient = HttpAsyncClients.custom()
                .setSSLStrategy(sslSessionStrategy)
                .build();
        try {
            httpclient.start();
            HttpGet request = new HttpGet("https://issues.apache.org/");
            Future<HttpResponse> future = httpclient.execute(request, null);
            HttpResponse response = future.get();
            System.out.println("Response: " + response.getStatusLine());
            System.out.println("Shutting down");
View Full Code Here


            localContext.setCookieStore(cookieStore);
            localContext.setCredentialsProvider(credentialsProvider);

            System.out.println("Executing request " + httpget.getRequestLine());

            httpclient.start();

            // Pass local context as a parameter
            Future<HttpResponse> future = httpclient.execute(httpget, localContext, null);

            // Please note that it may be unsafe to access HttpContext instance
View Full Code Here

            .setConnectTimeout(3000).build();
        CloseableHttpAsyncClient httpclient = HttpAsyncClients.custom()
            .setDefaultRequestConfig(requestConfig)
            .build();
        try {
            httpclient.start();
            final HttpGet[] requests = new HttpGet[] {
                    new HttpGet("http://www.apache.org/"),
                    new HttpGet("https://www.verisign.com/"),
                    new HttpGet("http://www.google.com/")
            };
View Full Code Here

public class AsyncClientHttpExchangeStreaming {

    public static void main(final String[] args) throws Exception {
        CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault();
        try {
            httpclient.start();
            Future<Boolean> future = httpclient.execute(
                    HttpAsyncMethods.createGet("http://localhost:8080/"),
                    new MyResponseConsumer(), null);
            Boolean result = future.get();
            if (result != null && result.booleanValue()) {
View Full Code Here

            body.append(".");
        }

        CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault();
        try {
            httpclient.start();
            URI url = new URI(webServer.getUri() + "/");
            HttpPost request = new HttpPost(url);
            httpclient.execute(request, null);
            latch2.await();
View Full Code Here

  }

  private void startAsyncClient() {
        CloseableHttpAsyncClient asyncClient = getHttpAsyncClient();
    if (!asyncClient.isRunning()) {
      asyncClient.start();
    }
  }

  @Override
  public AsyncClientHttpRequest createAsyncRequest(URI uri, HttpMethod httpMethod) throws IOException {
View Full Code Here

    HttpAsyncClientBuilder builder = HttpAsyncClients.custom().setDefaultRequestConfig(requestConfig);
    // default is 2 per host which won't let us monitor multiple directories
    builder.setMaxConnPerRoute(Integer.MAX_VALUE);
    builder.setMaxConnTotal(Integer.MAX_VALUE);
    CloseableHttpAsyncClient httpClient = builder.build();
    httpClient.start();
    return httpClient;
  }

  public EtcdClient(URI baseUri) {
    this(baseUri, buildDefaultHttpClient());
View Full Code Here

    NoConnectionReuseStrategy reuseStrategy = new NoConnectionReuseStrategy();

    CloseableHttpAsyncClient asyncClient = HttpAsyncClients.custom()
        .setConnectionReuseStrategy(reuseStrategy)
        .setDefaultRequestConfig(requestConfig).build();
    asyncClient.start();
    return asyncClient;
  }

  public static class ResponseCallback implements
      FutureCallback<HttpResponse> {
View Full Code Here

          .setConnectTimeout(3000).build();
      CloseableHttpAsyncClient httpclient = HttpAsyncClients.custom()
          .setDefaultRequestConfig(requestConfig)
          .build();
      try {
        httpclient.start();
        double requestIndex = (double)limit/100;
        int period = (int)Math.ceil(requestIndex);
        final HttpGet[] requests = new HttpGet[period];
        for (int i = 0; i < period; i++) {
          requests[i] = new HttpGet(ARTICLELIST_URL_STRING + "/start:" + i*100);
 
View Full Code Here

          .setConnectTimeout(3000).build();
      CloseableHttpAsyncClient httpclient = HttpAsyncClients.custom()
          .setDefaultRequestConfig(requestConfig)
          .build();
      try {
        httpclient.start();
        double requestIndex = (double)limit/100;
        int period = (int)Math.ceil(requestIndex);
        final HttpGet[] requests = new HttpGet[period];
        for (int i = 0; i < period; i++) {
          requests[i] = new HttpGet(ARTICLELIST_URL_STRING + "/start:" + i*100);
 
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.