use of org.apache.hc.core5.http.message.BasicHttpResponse in project httpcomponents-core by apache.
the class TestDefaultConnectionReuseStrategy method testConnectionTokens3.
@Test
public void testConnectionTokens3() throws Exception {
// Use HTTP 1.1
final HttpResponse response = new BasicHttpResponse(200, "OK");
response.addHeader("Transfer-Encoding", "chunked");
response.addHeader("Connection", "yadda, keep-alive, close, dumdy");
Assertions.assertFalse(reuseStrategy.keepAlive(null, response, context));
}
use of org.apache.hc.core5.http.message.BasicHttpResponse in project httpcomponents-core by apache.
the class TestDefaultConnectionReuseStrategy method testMultipleContentLength.
@Test
public void testMultipleContentLength() throws Exception {
// Use HTTP 1.1
final HttpResponse response = new BasicHttpResponse(200, "OK");
response.addHeader("Content-Length", "10");
response.addHeader("Content-Length", "11");
Assertions.assertFalse(reuseStrategy.keepAlive(null, response, context));
}
use of org.apache.hc.core5.http.message.BasicHttpResponse in project httpcomponents-core by apache.
the class TestDefaultConnectionReuseStrategy method testHTTP10Default.
@Test
public void testHTTP10Default() throws Exception {
final HttpResponse response = new BasicHttpResponse(200, "OK");
response.setVersion(HttpVersion.HTTP_1_0);
response.addHeader("Content-Length", "10");
Assertions.assertFalse(reuseStrategy.keepAlive(null, response, context));
}
use of org.apache.hc.core5.http.message.BasicHttpResponse in project httpcomponents-core by apache.
the class TestDefaultConnectionReuseStrategy method testConnectionTokens1.
@Test
public void testConnectionTokens1() throws Exception {
// Use HTTP 1.1
final HttpResponse response = new BasicHttpResponse(200, "OK");
response.addHeader("Transfer-Encoding", "chunked");
response.addHeader("Connection", "yadda, cLOSe, dumdy");
Assertions.assertFalse(reuseStrategy.keepAlive(null, response, context));
}
use of org.apache.hc.core5.http.message.BasicHttpResponse in project httpcomponents-core by apache.
the class TestDefaultConnectionReuseStrategy method testConnectionTokens6.
@Test
public void testConnectionTokens6() throws Exception {
// Use HTTP 1.1
final HttpResponse response = new BasicHttpResponse(200, "OK");
response.addHeader("Transfer-Encoding", "chunked");
response.addHeader("Connection", "");
response.addHeader("Proxy-Connection", "close");
// Connection takes precedence over Proxy-Connection,
// even if it is empty. Default for HTTP/1.1 is to keep alive.
Assertions.assertTrue(reuseStrategy.keepAlive(null, response, context));
}
Aggregations