[prev in list] [next in list] [prev in thread] [next in thread]
List: httpcomponents-commits
Subject: [httpcomponents-client] 01/01: HTTPCLIENT-2173: test case for identity transfer encoded response mes
From: olegk () apache ! org
Date: 2021-08-31 13:46:24
Message-ID: 20210831134623.5471981F2D () gitbox ! apache ! org
[Download RAW message or body]
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit d234e555dbd5d94016ccd5c46f456514e5b89720
Author: Oleg Kalnichevski <olegk@apache.org>
AuthorDate: Tue Aug 31 15:38:51 2021 +0200
HTTPCLIENT-2173: test case for identity transfer encoded response messages
---
.../async/AbstractHttpAsyncFundamentalsTest.java | 6 ++--
.../hc/client5/testing/async/TestHttp1Async.java | 32 +++++++++++++++++++++-
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java \
b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
index a7e8cd6..ca7b494 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
@@ -62,7 +62,7 @@ public abstract class AbstractHttpAsyncFundamentalsTest<T extends \
CloseableHttpA }
@Test
- public void testSequenctialGetRequests() throws Exception {
+ public void testSequentialGetRequests() throws Exception {
final HttpHost target = start();
for (int i = 0; i < 3; i++) {
final Future<SimpleHttpResponse> future = httpclient.execute(
@@ -80,7 +80,7 @@ public abstract class AbstractHttpAsyncFundamentalsTest<T extends \
CloseableHttpA }
@Test
- public void testSequenctialHeadRequests() throws Exception {
+ public void testSequentialHeadRequests() throws Exception {
final HttpHost target = start();
for (int i = 0; i < 3; i++) {
final Future<SimpleHttpResponse> future = httpclient.execute(
@@ -97,7 +97,7 @@ public abstract class AbstractHttpAsyncFundamentalsTest<T extends \
CloseableHttpA }
@Test
- public void testSequenctialPostRequests() throws Exception {
+ public void testSequentialPostRequests() throws Exception {
final HttpHost target = start();
for (int i = 0; i < 3; i++) {
final byte[] b1 = new byte[1024];
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java \
b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
index 944e284..d5d18a1 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
@@ -28,6 +28,8 @@ package org.apache.hc.client5.testing.async;
import java.util.Arrays;
import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Queue;
import java.util.Random;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
@@ -50,6 +52,8 @@ import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.http.config.Http1Config;
+import org.apache.hc.core5.http.protocol.DefaultHttpProcessor;
+import org.apache.hc.core5.http.protocol.RequestValidateHost;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Rule;
@@ -122,7 +126,7 @@ public class TestHttp1Async extends \
AbstractHttpAsyncFundamentalsTest<CloseableH }
@Test
- public void testSequenctialGetRequestsCloseConnection() throws Exception {
+ public void testSequentialGetRequestsCloseConnection() throws Exception {
final HttpHost target = start();
for (int i = 0; i < 3; i++) {
final Future<SimpleHttpResponse> future = httpclient.execute(
@@ -141,6 +145,32 @@ public class TestHttp1Async extends \
AbstractHttpAsyncFundamentalsTest<CloseableH }
@Test
+ public void testGetRequestsIdentityEncodingResponse() throws Exception {
+ final HttpHost target = start(new DefaultHttpProcessor(new \
RequestValidateHost()), Http1Config.DEFAULT); +
+ final int reqCount = 20;
+
+ final Queue<Future<SimpleHttpResponse>> queue = new LinkedList<>();
+ for (int i = 0; i < reqCount; i++) {
+ final Future<SimpleHttpResponse> future = httpclient.execute(
+ SimpleRequestBuilder.get()
+ .setHttpHost(target)
+ .setPath("/random/2048")
+ .build(), null);
+ queue.add(future);
+ }
+ while (!queue.isEmpty()) {
+ final Future<SimpleHttpResponse> future = queue.remove();
+ final SimpleHttpResponse response = future.get();
+ Assert.assertThat(response, CoreMatchers.notNullValue());
+ Assert.assertThat(response.getCode(), CoreMatchers.equalTo(200));
+ final String body = response.getBodyText();
+ Assert.assertThat(body, CoreMatchers.notNullValue());
+ Assert.assertThat(body.length(), CoreMatchers.equalTo(2048));
+ }
+ }
+
+ @Test
public void testConcurrentPostsOverMultipleConnections() throws Exception {
connManager.setDefaultMaxPerRoute(20);
connManager.setMaxTotal(100);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic