Skip to content

Commit e9f0b87

Browse files
committed
Reverting.
1 parent b8736f9 commit e9f0b87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+188
-234
lines changed

api/src/test/java/org/asynchttpclient/async/AsyncProvidersBasicTest.java

Lines changed: 43 additions & 43 deletions
Large diffs are not rendered by default.

api/src/test/java/org/asynchttpclient/async/AsyncStreamHandlerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ public STATE onStatusReceived(HttpResponseStatus responseStatus) throws Exceptio
560560
public Response onCompleted() throws Exception {
561561
return builder.build();
562562
}
563-
}).get(5, TimeUnit.SECONDS);
563+
}).get();
564564

565565
assertNotNull(r);
566566
assertEquals(r.getStatusCode(), 200);

api/src/test/java/org/asynchttpclient/async/AuthTimeoutTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void basicAuthTimeoutTest() throws Exception {
8585
AsyncHttpClient client = newClient();
8686
try {
8787
Future<Response> f = execute(client, server, false);
88-
f.get(5, TimeUnit.SECONDS);
88+
f.get();
8989
fail("expected timeout");
9090
} catch (Exception e) {
9191
inspectException(e);
@@ -99,7 +99,7 @@ public void basicPreemptiveAuthTimeoutTest() throws Exception {
9999
AsyncHttpClient client = newClient();
100100
try {
101101
Future<Response> f = execute(client, server, true);
102-
f.get(5, TimeUnit.SECONDS);
102+
f.get();
103103
fail("expected timeout");
104104
} catch (Exception e) {
105105
inspectException(e);
@@ -113,7 +113,7 @@ public void digestAuthTimeoutTest() throws Exception {
113113
AsyncHttpClient client = newClient();
114114
try {
115115
Future<Response> f = execute(client, server2, false);
116-
f.get(5, TimeUnit.SECONDS);
116+
f.get();
117117
fail("expected timeout");
118118
} catch (Exception e) {
119119
inspectException(e);
@@ -127,7 +127,7 @@ public void digestPreemptiveAuthTimeoutTest() throws Exception {
127127
AsyncHttpClient client = newClient();
128128
try {
129129
Future<Response> f = execute(client, server2, true);
130-
f.get(5, TimeUnit.SECONDS);
130+
f.get();
131131
fail("expected timeout");
132132
} catch (Exception e) {
133133
inspectException(e);

api/src/test/java/org/asynchttpclient/async/BasicAuthTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ public void stringBuilderBodyConsumerTest() throws Exception {
351351
StringBuilder s = new StringBuilder();
352352
Future<Response> future = client.post(new InputStreamBodyGenerator(new ByteArrayInputStream(MY_MESSAGE.getBytes())), new AppendableBodyConsumer(s));
353353

354-
Response response = future.get(3, TimeUnit.SECONDS);
354+
Response response = future.get();
355355
assertEquals(response.getStatusCode(), 200);
356356
assertEquals(s.toString(), MY_MESSAGE);
357357
assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK);

api/src/test/java/org/asynchttpclient/async/BasicHttpsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void zeroCopyPostTest() throws Exception {
4242

4343
final AsyncHttpClient client = getAsyncHttpClient(new Builder().setSSLContext(createSSLContext(new AtomicBoolean(true))).build());
4444
try {
45-
Response resp = client.preparePost(getTargetUrl()).setBody(SIMPLE_TEXT_FILE).setHeader("Content-Type", "text/html").execute().get(5, TimeUnit.SECONDS);
45+
Response resp = client.preparePost(getTargetUrl()).setBody(SIMPLE_TEXT_FILE).setHeader("Content-Type", "text/html").execute().get();
4646
assertNotNull(resp);
4747
assertEquals(resp.getStatusCode(), HttpServletResponse.SC_OK);
4848
assertEquals(resp.getResponseBody(), SIMPLE_TEXT_FILE_STRING);
@@ -80,7 +80,7 @@ public void multipleSSLWithoutCacheTest() throws Exception {
8080

8181
c.preparePost(getTargetUrl()).setBody(body).setHeader("Content-Type", "text/html").execute();
8282

83-
Response response = c.preparePost(getTargetUrl()).setBody(body).setHeader("Content-Type", "text/html").execute().get(5, TimeUnit.SECONDS);
83+
Response response = c.preparePost(getTargetUrl()).setBody(body).setHeader("Content-Type", "text/html").execute().get();
8484

8585
assertEquals(response.getResponseBody(), body);
8686
} finally {

api/src/test/java/org/asynchttpclient/async/BodyChunkTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import java.io.ByteArrayInputStream;
2626
import java.util.concurrent.Future;
27-
import java.util.concurrent.TimeUnit;
2827

2928
import static org.testng.Assert.assertEquals;
3029

@@ -51,7 +50,7 @@ public void negativeContentTypeTest() throws Exception {
5150
Future<Response> future = client.executeRequest(requestBuilder.build());
5251

5352
System.out.println("waiting for response");
54-
Response response = future.get(5, TimeUnit.SECONDS);
53+
Response response = future.get();
5554
assertEquals(response.getStatusCode(), 200);
5655
assertEquals(response.getResponseBody(), MY_MESSAGE);
5756
} finally {

api/src/test/java/org/asynchttpclient/async/BodyDeferringAsyncHandlerTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.io.PipedOutputStream;
2323
import java.util.concurrent.ExecutionException;
2424
import java.util.concurrent.Future;
25-
import java.util.concurrent.TimeUnit;
2625
import java.util.concurrent.TimeoutException;
2726

2827
import javax.servlet.ServletException;
@@ -127,7 +126,7 @@ public void deferredSimple() throws IOException, ExecutionException, TimeoutExce
127126

128127
// now be polite and wait for body arrival too (otherwise we would be
129128
// dropping the "line" on server)
130-
f.get(5, TimeUnit.SECONDS);
129+
f.get();
131130
// it all should be here now
132131
assertEquals(cos.getByteCount(), HALF_GIG);
133132
} finally {
@@ -156,7 +155,7 @@ public void deferredSimpleWithFailure() throws IOException, ExecutionException,
156155
// now be polite and wait for body arrival too (otherwise we would be
157156
// dropping the "line" on server)
158157
try {
159-
f.get(5, TimeUnit.SECONDS);
158+
f.get();
160159
fail("get() should fail with IOException!");
161160
} catch (Exception e) {
162161
// good

api/src/test/java/org/asynchttpclient/async/ByteBufferCapacityTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.io.InputStream;
2121
import java.io.OutputStream;
2222
import java.util.Enumeration;
23-
import java.util.concurrent.TimeUnit;
2423
import java.util.concurrent.atomic.AtomicInteger;
2524

2625
import javax.servlet.ServletException;
@@ -87,7 +86,7 @@ public STATE onBodyPartReceived(final HttpResponseBodyPart content) throws Excep
8786
return super.onBodyPartReceived(content);
8887
}
8988

90-
}).get(5, TimeUnit.SECONDS);
89+
}).get();
9190

9291
assertNotNull(response);
9392
assertEquals(response.getStatusCode(), 200);

api/src/test/java/org/asynchttpclient/async/ChunkingTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import java.io.BufferedInputStream;
2020
import java.io.FileInputStream;
21-
import java.util.concurrent.TimeUnit;
2221

2322
import org.asynchttpclient.AsyncHttpClient;
2423
import org.asynchttpclient.AsyncHttpClientConfig;
@@ -61,7 +60,7 @@ public void testCustomChunking() throws Exception {
6160

6261
Request r = builder.build();
6362

64-
Response response = c.executeRequest(r).get(5, TimeUnit.SECONDS);
63+
Response response = c.executeRequest(r).get();
6564
if (500 == response.getStatusCode()) {
6665
StringBuilder sb = new StringBuilder();
6766
sb.append("==============\n");

api/src/test/java/org/asynchttpclient/async/ConnectionPoolTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void testMaxTotalConnections() {
4747
for (i = 0; i < 3; i++) {
4848
try {
4949
log.info("{} requesting url [{}]...", i, url);
50-
Response response = client.prepareGet(url).execute().get(5, TimeUnit.SECONDS);
50+
Response response = client.prepareGet(url).execute().get();
5151
log.info("{} response [{}].", i, response);
5252
} catch (Exception ex) {
5353
exception = ex;
@@ -71,7 +71,7 @@ public void testMaxTotalConnectionsException() {
7171
log.info("{} requesting url [{}]...", i, url);
7272

7373
if (i < 5) {
74-
client.prepareGet(url).execute().get(5, TimeUnit.SECONDS);
74+
client.prepareGet(url).execute().get();
7575
} else {
7676
client.prepareGet(url).execute();
7777
}
@@ -112,7 +112,7 @@ public Response onCompleted(Response response) throws Exception {
112112
}
113113
};
114114

115-
client.prepareGet(getTargetUrl()).execute(handler).get(5, TimeUnit.SECONDS);
115+
client.prepareGet(getTargetUrl()).execute(handler).get();
116116
server.stop();
117117
server.start();
118118
client.prepareGet(getTargetUrl()).execute(handler);
@@ -215,7 +215,7 @@ public Response onCompleted(Response response) throws Exception {
215215
};
216216

217217
try {
218-
client.prepareGet(getTargetUrl()).execute(handler).get(5, TimeUnit.SECONDS);
218+
client.prepareGet(getTargetUrl()).execute(handler).get();
219219
fail("Must have received an exception");
220220
} catch (ExecutionException ex) {
221221
assertNotNull(ex);

api/src/test/java/org/asynchttpclient/async/EmptyBodyTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public Object onCompleted() throws Exception {
127127
public void testPutEmptyBody() throws Exception {
128128
AsyncHttpClient ahc = getAsyncHttpClient(null);
129129
try {
130-
Response response = ahc.preparePut(getTargetUrl()).setBody("String").execute().get(5, TimeUnit.SECONDS);
130+
Response response = ahc.preparePut(getTargetUrl()).setBody("String").execute().get();
131131

132132
assertNotNull(response);
133133
assertEquals(response.getStatusCode(), 204);

api/src/test/java/org/asynchttpclient/async/Expect100ContinueTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import java.io.IOException;
2222
import java.util.concurrent.Future;
23-
import java.util.concurrent.TimeUnit;
2423

2524
import javax.servlet.ServletException;
2625
import javax.servlet.http.HttpServletRequest;
@@ -65,7 +64,7 @@ public void Expect100Continue() throws Exception {
6564
AsyncHttpClient client = getAsyncHttpClient(null);
6665
try {
6766
Future<Response> f = client.preparePut("http://127.0.0.1:" + port1 + "/").setHeader("Expect", "100-continue").setBody(SIMPLE_TEXT_FILE).execute();
68-
Response resp = f.get(5, TimeUnit.SECONDS);
67+
Response resp = f.get();
6968
assertNotNull(resp);
7069
assertEquals(resp.getStatusCode(), HttpServletResponse.SC_OK);
7170
assertEquals(resp.getResponseBody(), SIMPLE_TEXT_FILE_STRING);

api/src/test/java/org/asynchttpclient/async/FilePartLargeFileTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import java.io.File;
1919
import java.io.IOException;
20-
import java.util.concurrent.TimeUnit;
2120

2221
import javax.servlet.ServletException;
2322
import javax.servlet.ServletInputStream;
@@ -63,7 +62,7 @@ public void handle(String arg0, Request arg1, HttpServletRequest req, HttpServle
6362
public void testPutImageFile() throws Exception {
6463
AsyncHttpClient client = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().setRequestTimeoutInMs(100 * 6000).build());
6564
try {
66-
Response response = client.preparePut(getTargetUrl()).addBodyPart(new FilePart("test", LARGE_IMAGE_FILE, "application/octet-stream", "UTF-8")).execute().get(5, TimeUnit.SECONDS);
65+
Response response = client.preparePut(getTargetUrl()).addBodyPart(new FilePart("test", LARGE_IMAGE_FILE, "application/octet-stream", "UTF-8")).execute().get();
6766
assertEquals(response.getStatusCode(), 200);
6867
} finally {
6968
client.close();
@@ -76,7 +75,7 @@ public void testPutLargeTextFile() throws Exception {
7675

7776
AsyncHttpClient client = getAsyncHttpClient(null);
7877
try {
79-
Response response = client.preparePut(getTargetUrl()).addBodyPart(new FilePart("test", file, "application/octet-stream", "UTF-8")).execute().get(5, TimeUnit.SECONDS);
78+
Response response = client.preparePut(getTargetUrl()).addBodyPart(new FilePart("test", file, "application/octet-stream", "UTF-8")).execute().get();
8079
assertEquals(response.getStatusCode(), 200);
8180
} finally {
8281
client.close();

api/src/test/java/org/asynchttpclient/async/FilterTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import java.util.Enumeration;
3333
import java.util.List;
3434
import java.util.concurrent.Future;
35-
import java.util.concurrent.TimeUnit;
3635
import java.util.concurrent.atomic.AtomicBoolean;
3736

3837
import static org.testng.Assert.assertEquals;
@@ -74,7 +73,7 @@ public void basicTest() throws Exception {
7473

7574
AsyncHttpClient c = getAsyncHttpClient(b.build());
7675
try {
77-
Response response = c.preparePost(getTargetUrl()).execute().get(5, TimeUnit.SECONDS);
76+
Response response = c.preparePost(getTargetUrl()).execute().get();
7877
assertNotNull(response);
7978
assertEquals(response.getStatusCode(), 200);
8079
} finally {
@@ -95,7 +94,7 @@ public void loadThrottleTest() throws Exception {
9594
}
9695

9796
for (Future<Response> f : futures) {
98-
Response r = f.get(5, TimeUnit.SECONDS);
97+
Response r = f.get();
9998
assertNotNull(f.get());
10099
assertEquals(r.getStatusCode(), 200);
101100
}
@@ -111,7 +110,7 @@ public void maxConnectionsText() throws Exception {
111110
AsyncHttpClient c = getAsyncHttpClient(b.build());
112111

113112
try {
114-
/* Response response = */c.preparePost(getTargetUrl()).execute().get(5, TimeUnit.SECONDS);
113+
/* Response response = */c.preparePost(getTargetUrl()).execute().get();
115114
fail("Should have timed out");
116115
} catch (IOException ex) {
117116
assertNotNull(ex);
@@ -135,7 +134,7 @@ public <T> FilterContext<T> filter(FilterContext<T> ctx) throws FilterException
135134
AsyncHttpClient c = getAsyncHttpClient(b.build());
136135

137136
try {
138-
Response response = c.preparePost(getTargetUrl()).execute().get(5, TimeUnit.SECONDS);
137+
Response response = c.preparePost(getTargetUrl()).execute().get();
139138

140139
assertNotNull(response);
141140
assertEquals(response.getStatusCode(), 200);
@@ -166,7 +165,7 @@ public <T> FilterContext<T> filter(FilterContext<T> ctx) throws FilterException
166165
AsyncHttpClient c = getAsyncHttpClient(b.build());
167166

168167
try {
169-
Response response = c.preparePost(getTargetUrl()).execute().get(5, TimeUnit.SECONDS);
168+
Response response = c.preparePost(getTargetUrl()).execute().get();
170169

171170
assertNotNull(response);
172171
assertEquals(response.getStatusCode(), 200);
@@ -198,7 +197,7 @@ public <T> FilterContext<T> filter(FilterContext<T> ctx) throws FilterException
198197
AsyncHttpClient c = getAsyncHttpClient(b.build());
199198

200199
try {
201-
Response response = c.preparePost(getTargetUrl()).execute().get(5, TimeUnit.SECONDS);
200+
Response response = c.preparePost(getTargetUrl()).execute().get();
202201

203202
assertNotNull(response);
204203
assertEquals(response.getStatusCode(), 200);
@@ -231,7 +230,7 @@ public <T> FilterContext<T> filter(FilterContext<T> ctx) throws FilterException
231230
AsyncHttpClient c = getAsyncHttpClient(b.build());
232231

233232
try {
234-
Response response = c.preparePost(getTargetUrl()).addHeader("Ping", "Pong").execute().get(5, TimeUnit.SECONDS);
233+
Response response = c.preparePost(getTargetUrl()).addHeader("Ping", "Pong").execute().get();
235234

236235
assertNotNull(response);
237236
assertEquals(response.getStatusCode(), 200);

api/src/test/java/org/asynchttpclient/async/HostnameVerifierTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.Enumeration;
2121
import java.util.concurrent.ExecutionException;
2222
import java.util.concurrent.Future;
23-
import java.util.concurrent.TimeUnit;
2423
import java.util.concurrent.atomic.AtomicBoolean;
2524

2625
import javax.net.ssl.HostnameVerifier;
@@ -131,7 +130,7 @@ public void positiveHostnameVerifierTest() throws Exception {
131130
final AsyncHttpClient client = getAsyncHttpClient(new Builder().setHostnameVerifier(new PositiveHostVerifier()).setSSLContext(createSSLContext(new AtomicBoolean(true))).build());
132131
try {
133132
Future<Response> f = client.preparePost(getTargetUrl()).setBody(SIMPLE_TEXT_FILE).setHeader("Content-Type", "text/html").execute();
134-
Response resp = f.get(5, TimeUnit.SECONDS);
133+
Response resp = f.get();
135134
assertNotNull(resp);
136135
assertEquals(resp.getStatusCode(), HttpServletResponse.SC_OK);
137136
assertEquals(resp.getResponseBody(), SIMPLE_TEXT_FILE_STRING);
@@ -146,7 +145,7 @@ public void negativeHostnameVerifierTest() throws Exception {
146145
final AsyncHttpClient client = getAsyncHttpClient(new Builder().setHostnameVerifier(new NegativeHostVerifier()).setSSLContext(createSSLContext(new AtomicBoolean(true))).build());
147146
try {
148147
try {
149-
client.preparePost(getTargetUrl()).setBody(SIMPLE_TEXT_FILE).setHeader("Content-Type", "text/html").execute().get(5, TimeUnit.SECONDS);
148+
client.preparePost(getTargetUrl()).setBody(SIMPLE_TEXT_FILE).setHeader("Content-Type", "text/html").execute().get();
150149
fail("ConnectException expected");
151150
} catch (ExecutionException ex) {
152151
assertEquals(ex.getCause().getClass(), ConnectException.class);
@@ -161,7 +160,7 @@ public void remoteIDHostnameVerifierTest() throws Exception {
161160

162161
final AsyncHttpClient client = getAsyncHttpClient(new Builder().setHostnameVerifier(new CheckHost("bouette")).setSSLContext(createSSLContext(new AtomicBoolean(true))).build());
163162
try {
164-
client.preparePost(getTargetUrl()).setBody(SIMPLE_TEXT_FILE).setHeader("Content-Type", "text/html").execute().get(5, TimeUnit.SECONDS);
163+
client.preparePost(getTargetUrl()).setBody(SIMPLE_TEXT_FILE).setHeader("Content-Type", "text/html").execute().get();
165164
fail("ConnectException expected");
166165
} catch (ExecutionException ex) {
167166
assertEquals(ex.getCause().getClass(), ConnectException.class);
@@ -175,7 +174,7 @@ public void remoteNegHostnameVerifierTest() throws Exception {
175174
// request is made to 127.0.0.1, but cert presented for localhost - this should fail
176175
final AsyncHttpClient client = getAsyncHttpClient(new Builder().setHostnameVerifier(new CheckHost("localhost")).setSSLContext(createSSLContext(new AtomicBoolean(true))).build());
177176
try {
178-
client.preparePost(getTargetUrl()).setBody(SIMPLE_TEXT_FILE).setHeader("Content-Type", "text/html").execute().get(5, TimeUnit.SECONDS);
177+
client.preparePost(getTargetUrl()).setBody(SIMPLE_TEXT_FILE).setHeader("Content-Type", "text/html").execute().get();
179178
fail("ConnectException expected");
180179
} catch (ExecutionException ex) {
181180
assertEquals(ex.getCause().getClass(), ConnectException.class);
@@ -189,7 +188,7 @@ public void remotePosHostnameVerifierTest() throws Exception {
189188

190189
final AsyncHttpClient client = getAsyncHttpClient(new Builder().setHostnameVerifier(new CheckHost("127.0.0.1")).setSSLContext(createSSLContext(new AtomicBoolean(true))).build());
191190
try {
192-
Response resp = client.preparePost(getTargetUrl()).setBody(SIMPLE_TEXT_FILE).setHeader("Content-Type", "text/html").execute().get(5, TimeUnit.SECONDS);
191+
Response resp = client.preparePost(getTargetUrl()).setBody(SIMPLE_TEXT_FILE).setHeader("Content-Type", "text/html").execute().get();
193192
assertNotNull(resp);
194193
assertEquals(resp.getStatusCode(), HttpServletResponse.SC_OK);
195194
assertEquals(resp.getResponseBody(), SIMPLE_TEXT_FILE_STRING);

0 commit comments

Comments
 (0)