Package org.apache.http.impl.client

Examples of org.apache.http.impl.client.HttpClientBuilder.build()


        } else {
            HttpHost httpHost = new HttpHost("localhost", getProxyPort());
            DefaultProxyRoutePlanner defaultProxyRoutePlanner = new DefaultProxyRoutePlanner(httpHost);
            httpClientBuilder.setRoutePlanner(defaultProxyRoutePlanner);
        }
        return httpClientBuilder.build();
    }

    public abstract int getProxyPort();

    public abstract int getServerPort();
View Full Code Here


        remoteUsername = null;
      }
    } else {
      remoteUsername = null;
    }
    httpclient = clientBuilder.build();
    return remoteUsername;
  }

  /**
   * Get url from configuration and validate it for format, and for presence.
View Full Code Here

//                                    .setSoTimeout((int) TimeUnit.SECONDS.toMillis(10))
//                                    .setSoLinger((int) TimeUnit.SECONDS.toMillis(10))
//                                    .setSoKeepAlive(true)
//                                    .build()
//                    );
            this.httpClient = httpClientBuilder.build();
        } catch (Exception e) {
            throw new RuntimeException("Exception creating http client", e);
        }
    }
View Full Code Here

        if (!followRedirects) {
            httpClientBuilder.disableRedirectHandling();
        }

        httpClient = httpClientBuilder.build();

        httpAsyncClient = HttpAsyncClients.custom()
                .setDefaultRequestConfig(requestConfig)
                .setMaxConnPerRoute(metadata.getMaxConnectionsPerAddress())
                .setMaxConnTotal(metadata.getMaxConnectionsTotal())
View Full Code Here

            new UsernamePasswordCredentials(config.getProxyUserName(), config.getProxyPassword()));
        builder.setDefaultCredentialsProvider(credentialsProvider);
      }
    }

    return builder.build();
  }

  protected int getDefaultMaxPerRoute(GoogleAnalyticsConfig config) {
    return Math.max(config.getMaxThreads(), 1);
  }
View Full Code Here

            new UsernamePasswordCredentials(config.getProxyUserName(), config.getProxyPassword()));
        builder.setDefaultCredentialsProvider(credentialsProvider);
      }
    }

    return builder.build();
  }

  protected int getDefaultMaxPerRoute(GoogleAnalyticsConfig config) {
    return Math.max(config.getMaxThreads(), 1);
  }
View Full Code Here

                .build();

        clientBuilder.setDefaultRequestConfig(config);


        client = clientBuilder.build();
    }

    @After
    public void stop() {
        if (this.localServer != null) {
View Full Code Here

      credentialsProvider.setCredentials(new AuthScope(host, AuthScope.ANY_PORT), new UsernamePasswordCredentials(
          jiraUsername, jiraPassword));
      clientBuilder.setDefaultCredentialsProvider(credentialsProvider);
      isAuthConfigured = true;
    }
    httpclient = clientBuilder.build();
  }

  /**
   * Prepare JIRA API URL from JIRA base URL.
   *
 
View Full Code Here



    }

    c.setHttpClient(hcb.build());



    return c;
View Full Code Here

   */
  public HttpClient(String url) throws MalformedURLException
  {
    super(url);
    HttpClientBuilder builder = HttpClientBuilder.create();
    client = builder.build();
  }

  @Override
  protected ClientResponse postData(String json, String url) throws IOException
  {
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.