Skip to content

Commit 6de510f

Browse files
author
Stephane Landelle
committed
Minor clean up
1 parent 3d2569b commit 6de510f

11 files changed

+28
-42
lines changed

src/test/java/com/ning/http/client/async/AsyncProvidersBasicTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ public void onThrowable(Throwable t) {
828828

829829
@Test(groups = { "standalone", "default_provider", "async" })
830830
public void asyncRequestVirtualServerPOSTTest() throws Throwable {
831-
AsyncHttpClient client = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
831+
AsyncHttpClient client = getAsyncHttpClient(null);
832832
try {
833833
FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap();
834834
h.add("Content-Type", "application/x-www-form-urlencoded");
@@ -1716,7 +1716,7 @@ public void bodyAsByteTest() throws Throwable {
17161716

17171717
@Test(groups = { "default_provider", "async" })
17181718
public void mirrorByteTest() throws Throwable {
1719-
AsyncHttpClient client = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
1719+
AsyncHttpClient client = getAsyncHttpClient(null);
17201720
try {
17211721
Response r = client.preparePost(getTargetUrl()).setBody("MIRROR").execute().get();
17221722

src/test/java/com/ning/http/client/async/ConnectionPoolTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public void multipleMaxConnectionOpenTestWithQuery() throws Throwable {
282282
public void win7DisconnectTest() throws Throwable {
283283
final AtomicInteger count = new AtomicInteger(0);
284284

285-
AsyncHttpClient client = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
285+
AsyncHttpClient client = getAsyncHttpClient(null);
286286
try {
287287
AsyncCompletionHandler<Response> handler = new AsyncCompletionHandlerAdapter() {
288288

@@ -313,7 +313,7 @@ public Response onCompleted(Response response) throws Exception {
313313

314314
@Test(groups = { "standalone", "default_provider" })
315315
public void asyncHandlerOnThrowableTest() throws Throwable {
316-
AsyncHttpClient client = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
316+
AsyncHttpClient client = getAsyncHttpClient(null);
317317
try {
318318
final AtomicInteger count = new AtomicInteger();
319319
final String THIS_IS_NOT_FOR_YOU = "This is not for you";

src/test/java/com/ning/http/client/async/FilePartLargeFileTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ public void testPutLargeTextFile() throws Exception {
6464
long repeats = (1024 * 1024 / bytes.length) + 1;
6565
largeFile = createTempFile(bytes, (int) repeats);
6666

67-
AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().build();
68-
AsyncHttpClient client = getAsyncHttpClient(config);
67+
AsyncHttpClient client = getAsyncHttpClient(null);
6968
try {
7069
BoundRequestBuilder rb = client.preparePut(getTargetUrl());
7170

src/test/java/com/ning/http/client/async/NonAsciiContentLengthTest.java

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

1515
import com.ning.http.client.AsyncHttpClient;
1616
import com.ning.http.client.AsyncHttpClient.BoundRequestBuilder;
17-
import com.ning.http.client.AsyncHttpClientConfig;
1817
import com.ning.http.client.Response;
1918
import org.eclipse.jetty.server.Connector;
2019
import org.eclipse.jetty.server.Request;
@@ -82,7 +81,7 @@ public void testNonAsciiContentLength() throws Exception {
8281
}
8382

8483
protected void execute(String body) throws IOException, InterruptedException, ExecutionException {
85-
AsyncHttpClient client = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
84+
AsyncHttpClient client = getAsyncHttpClient(null);
8685
try {
8786
BoundRequestBuilder r = client.preparePost(getTargetUrl()).setBody(body).setBodyEncoding("UTF-8");
8887
Future<Response> f = r.execute();

src/test/java/com/ning/http/client/async/PerRequestRelative302Test.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ public void setUpGlobal() throws Exception {
8888
@Test(groups = { "online", "default_provider" })
8989
public void redirected302Test() throws Throwable {
9090
isSet.getAndSet(false);
91-
AsyncHttpClientConfig cg = new AsyncHttpClientConfig.Builder().build();
92-
AsyncHttpClient c = getAsyncHttpClient(cg);
91+
AsyncHttpClient c = getAsyncHttpClient(null);
9392
try {
9493

9594
// once
@@ -143,8 +142,7 @@ private static int getPort(URI uri) {
143142
@Test(groups = { "standalone", "default_provider" })
144143
public void redirected302InvalidTest() throws Throwable {
145144
isSet.getAndSet(false);
146-
AsyncHttpClientConfig cg = new AsyncHttpClientConfig.Builder().build();
147-
AsyncHttpClient c = getAsyncHttpClient(cg);
145+
AsyncHttpClient c = getAsyncHttpClient(null);
148146

149147
// If the test hit a proxy, no ConnectException will be thrown and instead of 404 will be returned.
150148
try {
@@ -163,8 +161,7 @@ public void redirected302InvalidTest() throws Throwable {
163161
public void relativeLocationUrl() throws Throwable {
164162
isSet.getAndSet(false);
165163

166-
AsyncHttpClientConfig cg = new AsyncHttpClientConfig.Builder().build();
167-
AsyncHttpClient c = getAsyncHttpClient(cg);
164+
AsyncHttpClient c = getAsyncHttpClient(null);
168165
try {
169166
Response response = c.preparePost(getTargetUrl()).setFollowRedirects(true).setHeader("X-redirect", "/foo/test").execute().get();
170167
assertNotNull(response);

src/test/java/com/ning/http/client/async/ProxyTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ public void testIgnoreProxyPropertiesByDefault() throws IOException, ExecutionEx
178178
System.setProperty("http.proxyPort", String.valueOf(port1));
179179
System.setProperty("http.nonProxyHosts", "localhost");
180180

181-
AsyncHttpClientConfig cfg = new AsyncHttpClientConfig.Builder().build();
182-
AsyncHttpClient client = getAsyncHttpClient(cfg);
181+
AsyncHttpClient client = getAsyncHttpClient(null);
183182
try {
184183
String target = "http://127.0.0.1:1234/";
185184
Future<Response> f = client.prepareGet(target).execute();
@@ -212,8 +211,7 @@ public void testProxyActivationProperty() throws IOException, ExecutionException
212211
System.setProperty("http.nonProxyHosts", "localhost");
213212
System.setProperty("com.ning.http.client.AsyncHttpClientConfig.useProxyProperties", "true");
214213

215-
AsyncHttpClientConfig cfg = new AsyncHttpClientConfig.Builder().build();
216-
AsyncHttpClient client = getAsyncHttpClient(cfg);
214+
AsyncHttpClient client = getAsyncHttpClient(null);
217215
try {
218216
String target = "http://127.0.0.1:1234/";
219217
Future<Response> f = client.prepareGet(target).execute();

src/test/java/com/ning/http/client/async/PutLargeFileTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ public void testPutSmallFile() throws Exception {
6464
long repeats = (1024 / bytes.length) + 1;
6565
largeFile = createTempFile(bytes, (int) repeats);
6666

67-
AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().build();
68-
AsyncHttpClient client = getAsyncHttpClient(config);
67+
AsyncHttpClient client = getAsyncHttpClient(null);
6968
try {
7069
BoundRequestBuilder rb = client.preparePut(getTargetUrl());
7170

src/test/java/com/ning/http/client/async/RemoteSiteTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public void invalidStreamTest2() throws Throwable {
165165

166166
@Test(groups = { "online", "default_provider" })
167167
public void asyncFullBodyProperlyRead() throws Throwable {
168-
final AsyncHttpClient client = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
168+
final AsyncHttpClient client = getAsyncHttpClient(null);
169169
try {
170170
Response r = client.prepareGet("http://www.cyberpresse.ca/").execute().get();
171171

src/test/java/com/ning/http/client/websocket/ByteMessageTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public org.eclipse.jetty.websocket.WebSocket doWebSocketConnect(HttpServletReque
6666

6767
@Test
6868
public void echoByte() throws Throwable {
69-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
69+
AsyncHttpClient c = getAsyncHttpClient(null);
7070
try {
7171
final CountDownLatch latch = new CountDownLatch(1);
7272
final AtomicReference<byte[]> text = new AtomicReference<byte[]>(new byte[0]);
@@ -110,7 +110,7 @@ public void onFragment(byte[] fragment, boolean last) {
110110

111111
@Test
112112
public void echoTwoMessagesTest() throws Throwable {
113-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
113+
AsyncHttpClient c = getAsyncHttpClient(null);
114114
try {
115115
final CountDownLatch latch = new CountDownLatch(2);
116116
final AtomicReference<byte[]> text = new AtomicReference<byte[]>(null);
@@ -161,7 +161,7 @@ public void onFragment(byte[] fragment, boolean last) {
161161

162162
@Test
163163
public void echoOnOpenMessagesTest() throws Throwable {
164-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
164+
AsyncHttpClient c = getAsyncHttpClient(null);
165165
try {
166166
final CountDownLatch latch = new CountDownLatch(2);
167167
final AtomicReference<byte[]> text = new AtomicReference<byte[]>(null);
@@ -210,7 +210,7 @@ public void onFragment(byte[] fragment, boolean last) {
210210
}
211211

212212
public void echoFragments() throws Exception {
213-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
213+
AsyncHttpClient c = getAsyncHttpClient(null);
214214
try {
215215
final CountDownLatch latch = new CountDownLatch(1);
216216
final AtomicReference<byte[]> text = new AtomicReference<byte[]>(null);

src/test/java/com/ning/http/client/websocket/CloseCodeReasonMessageTest.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,11 @@
1313
package com.ning.http.client.websocket;
1414

1515
import com.ning.http.client.AsyncHttpClient;
16-
import com.ning.http.client.AsyncHttpClientConfig;
17-
import com.ning.http.client.async.ProviderUtil;
1816
import com.ning.http.client.websocket.TextMessageTest;
1917
import com.ning.http.client.websocket.WebSocket;
2018
import com.ning.http.client.websocket.WebSocketCloseCodeReasonListener;
2119
import com.ning.http.client.websocket.WebSocketListener;
2220
import com.ning.http.client.websocket.WebSocketUpgradeHandler;
23-
import com.ning.http.client.websocket.netty.NettyTextMessageTest;
24-
import org.eclipse.jetty.server.nio.SelectChannelConnector;
25-
import org.testng.annotations.BeforeClass;
2621
import org.testng.annotations.Test;
2722

2823
import java.util.concurrent.CountDownLatch;
@@ -35,7 +30,7 @@ public abstract class CloseCodeReasonMessageTest extends TextMessageTest {
3530

3631
@Test(timeOut = 60000)
3732
public void onCloseWithCode() throws Throwable {
38-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
33+
AsyncHttpClient c = getAsyncHttpClient(null);
3934
try {
4035
final CountDownLatch latch = new CountDownLatch(1);
4136
final AtomicReference<String> text = new AtomicReference<String>("");
@@ -53,7 +48,7 @@ public void onCloseWithCode() throws Throwable {
5348

5449
@Test(timeOut = 60000)
5550
public void onCloseWithCodeServerClose() throws Throwable {
56-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
51+
AsyncHttpClient c = getAsyncHttpClient(null);
5752
try {
5853
final CountDownLatch latch = new CountDownLatch(1);
5954
final AtomicReference<String> text = new AtomicReference<String>("");

src/test/java/com/ning/http/client/websocket/TextMessageTest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
package com.ning.http.client.websocket;
1414

1515
import com.ning.http.client.AsyncHttpClient;
16-
import com.ning.http.client.AsyncHttpClientConfig;
1716
import org.testng.annotations.Test;
1817

1918
import javax.servlet.http.HttpServletRequest;
@@ -68,7 +67,7 @@ public org.eclipse.jetty.websocket.WebSocket doWebSocketConnect(HttpServletReque
6867

6968
@Test(timeOut = 60000)
7069
public void onOpen() throws Throwable {
71-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
70+
AsyncHttpClient c = getAsyncHttpClient(null);
7271
try {
7372
final CountDownLatch latch = new CountDownLatch(1);
7473
final AtomicReference<String> text = new AtomicReference<String>("");
@@ -101,7 +100,7 @@ public void onError(Throwable t) {
101100

102101
@Test(timeOut = 60000)
103102
public void onEmptyListenerTest() throws Throwable {
104-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
103+
AsyncHttpClient c = getAsyncHttpClient(null);
105104
try {
106105
WebSocket websocket = null;
107106
try {
@@ -117,7 +116,7 @@ public void onEmptyListenerTest() throws Throwable {
117116

118117
@Test(timeOut = 60000)
119118
public void onFailureTest() throws Throwable {
120-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
119+
AsyncHttpClient c = getAsyncHttpClient(null);
121120
try {
122121
Throwable t = null;
123122
try {
@@ -133,7 +132,7 @@ public void onFailureTest() throws Throwable {
133132

134133
@Test(timeOut = 60000)
135134
public void onTimeoutCloseTest() throws Throwable {
136-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
135+
AsyncHttpClient c = getAsyncHttpClient(null);
137136
try {
138137
final CountDownLatch latch = new CountDownLatch(1);
139138
final AtomicReference<String> text = new AtomicReference<String>("");
@@ -166,7 +165,7 @@ public void onError(Throwable t) {
166165

167166
@Test(timeOut = 60000)
168167
public void onClose() throws Throwable {
169-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
168+
AsyncHttpClient c = getAsyncHttpClient(null);
170169
try {
171170
final CountDownLatch latch = new CountDownLatch(1);
172171
final AtomicReference<String> text = new AtomicReference<String>("");
@@ -201,7 +200,7 @@ public void onError(Throwable t) {
201200

202201
@Test(timeOut = 60000)
203202
public void echoText() throws Throwable {
204-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
203+
AsyncHttpClient c = getAsyncHttpClient(null);
205204
try {
206205
final CountDownLatch latch = new CountDownLatch(1);
207206
final AtomicReference<String> text = new AtomicReference<String>("");
@@ -245,7 +244,7 @@ public void onError(Throwable t) {
245244

246245
@Test(timeOut = 60000)
247246
public void echoDoubleListenerText() throws Throwable {
248-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
247+
AsyncHttpClient c = getAsyncHttpClient(null);
249248
try {
250249
final CountDownLatch latch = new CountDownLatch(2);
251250
final AtomicReference<String> text = new AtomicReference<String>("");
@@ -315,7 +314,7 @@ public void onError(Throwable t) {
315314

316315
@Test
317316
public void echoTwoMessagesTest() throws Throwable {
318-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
317+
AsyncHttpClient c = getAsyncHttpClient(null);
319318
try {
320319
final CountDownLatch latch = new CountDownLatch(2);
321320
final AtomicReference<String> text = new AtomicReference<String>("");
@@ -359,7 +358,7 @@ public void onError(Throwable t) {
359358
}
360359

361360
public void echoFragments() throws Throwable {
362-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
361+
AsyncHttpClient c = getAsyncHttpClient(null);
363362
try {
364363
final CountDownLatch latch = new CountDownLatch(1);
365364
final AtomicReference<String> text = new AtomicReference<String>("");

0 commit comments

Comments
 (0)