Package org.apache.http.client

Examples of org.apache.http.client.HttpClient


    }

    @Test(expected = AssertionError.class)
    public void shouldVerifyNoRequestsTimesNotSpecified() throws Exception {
        // given
        HttpClient httpClient = createHttpClient();
        ProxyClient proxyClient = new ProxyClient("127.0.0.1", getProxyPort()).reset();

        // when
        httpClient.execute(
                new HttpGet(
                        new URIBuilder()
                                .setScheme("http")
                                .setHost("localhost")
                                .setPort(getServerPort())
View Full Code Here


    }

    @Test(expected = AssertionError.class)
    public void shouldVerifyNotEnoughRequests() throws Exception {
        // given
        HttpClient httpClient = createHttpClient();
        ProxyClient proxyClient = new ProxyClient("127.0.0.1", getProxyPort()).reset();

        // when
        httpClient.execute(
                new HttpGet(
                        new URIBuilder()
                                .setScheme("http")
                                .setHost("localhost")
                                .setPort(getServerPort())
                                .setPath("/test_headers_and_body")
                                .build()
                )
        );
        httpClient.execute(
                new HttpGet(
                        new URIBuilder()
                                .setScheme("http")
                                .setHost("localhost")
                                .setPort(getServerPort())
View Full Code Here

    }

    @Test
    public void shouldClearRequests() throws Exception {
        // given
        HttpClient httpClient = createHttpClient();
        ProxyClient proxyClient = new ProxyClient("127.0.0.1", getProxyPort()).reset();

        // when
        httpClient.execute(
                new HttpGet(
                        new URIBuilder()
                                .setScheme("http")
                                .setHost("localhost")
                                .setPort(getServerPort())
                                .setPath("/test_headers_and_body")
                                .build()
                )
        );
        httpClient.execute(
                new HttpGet(
                        new URIBuilder()
                                .setScheme("http")
                                .setHost("localhost")
                                .setPort(getServerPort())
View Full Code Here

    }

    @Test
    public void shouldResetRequests() throws Exception {
        // given
        HttpClient httpClient = createHttpClient();
        ProxyClient proxyClient = new ProxyClient("127.0.0.1", getProxyPort()).reset();

        // when
        httpClient.execute(
                new HttpGet(
                        new URIBuilder()
                                .setScheme("http")
                                .setHost("localhost")
                                .setPort(getServerPort())
                                .setPath("/test_headers_and_body")
                                .build()
                )
        );
        httpClient.execute(
                new HttpGet(
                        new URIBuilder()
                                .setScheme("http")
                                .setHost("localhost")
                                .setPort(getServerPort())
View Full Code Here

    }

    @Test
    public void shouldForwardRequestsToSecurePortUsingHttpClient() throws Exception {
        // given
        HttpClient httpClient = createHttpClient();

        // when
        HttpResponse response = httpClient.execute(
                new HttpGet(
                        new URIBuilder()
                                .setScheme("https")
                                .setHost("localhost")
                                .setPort(getServerSecurePort())
View Full Code Here

    } else {
      SchemeRegistry schemeRegistry = SchemeRegistryFactory.createDefault();
      connectionManager = buildConnectionManager(schemeRegistry);
    }

    HttpClient httpClient = buildDefaultHttpClient(connectionManager, httpParams);

    httpClient = wrapHttpClient(httpClient);

    return httpClient;
  }
View Full Code Here

  protected ClientConnectionManager buildConnectionManager(SchemeRegistry schemeRegistry) {
    return new PoolingClientConnectionManager(schemeRegistry);
  }

  protected HttpClient buildDefaultHttpClient(ClientConnectionManager connectionManager, HttpParams httpParams) {
    HttpClient httpClient = new DefaultHttpClient(connectionManager, httpParams);
    return httpClient;
  }
View Full Code Here

    return new InstrumentedClientConnManager(schemeRegistry);
  }

  @Override
  protected HttpClient buildDefaultHttpClient(ClientConnectionManager connectionManager, HttpParams httpParams) {
    HttpClient httpClient = new InstrumentedHttpClient((InstrumentedClientConnManager) connectionManager,
        httpParams);
    return httpClient;
  }
View Full Code Here

    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(new Scheme("https", port, schemeSocketFactory));

    PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager(schemeRegistry);

    HttpClient httpClient = new DefaultHttpClient(connectionManager);

    httpClient = new DecompressingHttpClient(httpClient);

    return httpClient;
  }
View Full Code Here

  @Inject
  ProviderHelper providers;

  private static JenkinsCasStore buildJenkins(String baseUrl) {
    HttpClient httpClient = new DefaultHttpClient();
    JenkinsClient jenkinsClient;
    try {
      jenkinsClient = new JenkinsClient(httpClient, new URI(baseUrl));
    } catch (URISyntaxException e) {
      throw new IllegalArgumentException("Error parsing URI", e);
View Full Code Here

TOP

Related Classes of org.apache.http.client.HttpClient

Copyright © 2018 www.massapicom. 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.