Examples of toHostString()


Examples of org.apache.http.HttpHost.toHostString()

    public void testAuthenticationUserinfoInRequestFailure() throws Exception {
        this.localServer.register("*", new AuthHandler());
        this.localServer.start();

        HttpHost target = getServerHttp();
        HttpGet httpget = new HttpGet("http://test:all-wrong@" +  target.toHostString() + "/");

        HttpResponse response = this.httpclient.execute(getServerHttp(), httpget);
        HttpEntity entity = response.getEntity();
        Assert.assertEquals(HttpStatus.SC_UNAUTHORIZED, response.getStatusLine().getStatusCode());
        Assert.assertNotNull(entity);
View Full Code Here

Examples of org.apache.http.HttpHost.toHostString()

                    } else {
                        throw new ProtocolException("Target host missing");
                    }
                }
            }
            request.addHeader(HTTP.TARGET_HOST, targethost.toHostString());
        }
    }

}
View Full Code Here

Examples of org.apache.http.HttpHost.toHostString()

                    } else {
                        throw new ProtocolException("Target host missing");
                    }
                }
            }
            request.addHeader(HTTP.TARGET_HOST, targethost.toHostString());
        }
    }
   
}
View Full Code Here

Examples of org.apache.http.HttpHost.toHostString()

           
            String agent = HttpProtocolParams.getUserAgent(params);
            if (agent != null) {
                connect.addHeader(HTTP.USER_AGENT, agent);
            }
            connect.addHeader(HTTP.TARGET_HOST, target.toHostString());
           
            AuthScheme authScheme = this.proxyAuthState.getAuthScheme();
            AuthScope authScope = this.proxyAuthState.getAuthScope();
            Credentials creds = this.proxyAuthState.getCredentials();
            if (creds != null) {
View Full Code Here

Examples of org.apache.http.HttpHost.toHostString()

            .setConnectionManager(this.connMgr)
            .build();

        final HttpHost target = start(registry, null);

        final HttpGet httpget = new HttpGet("http://test:test@" +  target.toHostString() + "/");
        final Future<HttpResponse> future = this.httpclient.execute(target, httpget, null);
        final HttpResponse response = future.get();
        Assert.assertNotNull(response);
        final HttpEntity entity = response.getEntity();
        Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
View Full Code Here

Examples of org.apache.http.HttpHost.toHostString()

            .setConnectionManager(this.connMgr)
            .build();

        final HttpHost target = start(registry, null);

        final HttpGet httpget = new HttpGet("http://test:all-wrong@" +  target.toHostString() + "/");

        final Future<HttpResponse> future = this.httpclient.execute(target, httpget, null);
        final HttpResponse response = future.get();
        Assert.assertNotNull(response);
        final HttpEntity entity = response.getEntity();
View Full Code Here

Examples of org.apache.http.HttpHost.toHostString()

    @Test
    public void testAuthenticationUserinfoInRequestSuccess() throws Exception {
        HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry();
        registry.register("*", new BasicAsyncRequestHandler(new AuthHandler()));
        HttpHost target = start(registry, null);
        HttpGet httpget = new HttpGet("http://test:test@" +  target.toHostString() + "/");
        Future<HttpResponse> future = this.httpclient.execute(target, httpget, null);
        HttpResponse response = future.get();
        Assert.assertNotNull(response);
        HttpEntity entity = response.getEntity();
        Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
View Full Code Here

Examples of org.apache.http.HttpHost.toHostString()

    @Test
    public void testAuthenticationUserinfoInRequestFailure() throws Exception {
        HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry();
        registry.register("*", new BasicAsyncRequestHandler(new AuthHandler()));
        HttpHost target = start(registry, null);
        HttpGet httpget = new HttpGet("http://test:all-wrong@" +  target.toHostString() + "/");

        Future<HttpResponse> future = this.httpclient.execute(target, httpget, null);
        HttpResponse response = future.get();
        Assert.assertNotNull(response);
        HttpEntity entity = response.getEntity();
View Full Code Here

Examples of org.apache.http.HttpHost.toHostString()

                    } else {
                        throw new ProtocolException("Target host missing");
                    }
                }
            }
            request.addHeader(HTTP.TARGET_HOST, targethost.toHostString());
        }
    }

}
View Full Code Here

Examples of org.apache.http.HttpHost.toHostString()

                } else {
                    host = route.getTargetHost();
                }
                final String authServer;
                if (!this.stripPort && host.getPort() > 0) {
                    authServer = host.toHostString();
                } else {
                    authServer = host.getHostName();
                }

                if (log.isDebugEnabled()) {
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.