Example usage for org.apache.http.conn.params ConnRouteParams NO_HOST

List of usage examples for org.apache.http.conn.params ConnRouteParams NO_HOST

Introduction

In this page you can find the example usage for org.apache.http.conn.params ConnRouteParams NO_HOST.

Prototype

HttpHost NO_HOST

To view the source code for org.apache.http.conn.params ConnRouteParams NO_HOST.

Click Source Link

Document

A special value indicating "no host".

Usage

From source file:android.net.http.AbstractProxyTest.java

public void testExplicitNoProxyCancelsSystemProperty() throws Exception {
    server.enqueue(new MockResponse().setBody("Via the origin server!"));
    server.play();/*from  w  w w  . jav  a 2 s.c o m*/
    System.setProperty("http.proxyHost", "proxy.foo");
    System.setProperty("http.proxyPort", "8080");

    HttpClient client = newHttpClient();
    HttpGet request = new HttpGet(server.getUrl("/bar").toURI());
    request.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, ConnRouteParams.NO_HOST);
    HttpResponse response = client.execute(request);
    assertEquals("Via the origin server!", contentToString(response));

    RecordedRequest recordedRequest = server.takeRequest();
    assertEquals("GET /bar HTTP/1.1", recordedRequest.getRequestLine());
}