Search in sources :

Example 6 with Response

use of com.atlassian.httpclient.api.Response in project jira-plugin by jenkinsci.

the class ApacheAsyncHttpClientTest method simple_get.

@Test
public void simple_get() throws Exception {
    TestHandler testHandler = new TestHandler();
    prepare(testHandler);
    ApacheAsyncHttpClient httpClient = new ApacheAsyncHttpClient(null, buildApplicationProperties(), new NoOpThreadLocalContextManager(), new HttpClientOptions());
    Response response = // 
    httpClient.newRequest("http://localhost:" + connector.getLocalPort() + "/foo").get().get(10, TimeUnit.SECONDS);
    Assert.assertEquals(200, response.getStatusCode());
    Assert.assertEquals(CONTENT_RESPONSE, IOUtils.toString(response.getEntityStream()));
}
Also used : Response(com.atlassian.httpclient.api.Response) HttpServletResponse(javax.servlet.http.HttpServletResponse) HttpClientOptions(com.atlassian.httpclient.api.factory.HttpClientOptions) Test(org.junit.Test)

Aggregations

Response (com.atlassian.httpclient.api.Response)6 HttpClientOptions (com.atlassian.httpclient.api.factory.HttpClientOptions)5 HttpServletResponse (javax.servlet.http.HttpServletResponse)5 Test (org.junit.Test)5 ProxyConfiguration (hudson.ProxyConfiguration)3 Header (org.apache.http.Header)1 HttpEntity (org.apache.http.HttpEntity)1 HttpResponse (org.apache.http.HttpResponse)1 StatusLine (org.apache.http.StatusLine)1