Skip to content

Commit 94f4962

Browse files
author
Stephane Landelle
committed
Minor clean up
1 parent 5756f83 commit 94f4962

File tree

11 files changed

+27
-38
lines changed

11 files changed

+27
-38
lines changed

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

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

206-
AsyncHttpClient client = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
206+
AsyncHttpClient client = getAsyncHttpClient(null);
207207
try {
208208
AsyncCompletionHandler<Response> handler = new AsyncCompletionHandlerAdapter() {
209209

@@ -234,7 +234,7 @@ public Response onCompleted(Response response) throws Exception {
234234

235235
@Test(groups = { "standalone", "default_provider" })
236236
public void asyncHandlerOnThrowableTest() throws Throwable {
237-
AsyncHttpClient client = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
237+
AsyncHttpClient client = getAsyncHttpClient(null);
238238
try {
239239
final AtomicInteger count = new AtomicInteger();
240240
final String THIS_IS_NOT_FOR_YOU = "This is not for you";

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

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

65-
AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().build();
66-
AsyncHttpClient client = getAsyncHttpClient(config);
65+
AsyncHttpClient client = getAsyncHttpClient(null);
6766
try {
6867
BoundRequestBuilder rb = client.preparePut(getTargetUrl());
6968

api/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();

api/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
Response response = c.prepareGet(getTargetUrl()).setFollowRedirects(true).setHeader("X-redirect", "http://www.microsoft.com/").execute().get();
9594

@@ -140,8 +139,7 @@ private static int getPort(URI uri) {
140139
@Test(groups = { "standalone", "default_provider" })
141140
public void redirected302InvalidTest() throws Throwable {
142141
isSet.getAndSet(false);
143-
AsyncHttpClientConfig cg = new AsyncHttpClientConfig.Builder().build();
144-
AsyncHttpClient c = getAsyncHttpClient(cg);
142+
AsyncHttpClient c = getAsyncHttpClient(null);
145143
try {
146144
// If the test hit a proxy, no ConnectException will be thrown and instead of 404 will be returned.
147145
Response response = c.preparePost(getTargetUrl()).setFollowRedirects(true).setHeader("X-redirect", String.format("http://127.0.0.1:%d/", port2)).execute().get();
@@ -159,8 +157,7 @@ public void redirected302InvalidTest() throws Throwable {
159157
public void relativeLocationUrl() throws Throwable {
160158
isSet.getAndSet(false);
161159

162-
AsyncHttpClientConfig cg = new AsyncHttpClientConfig.Builder().build();
163-
AsyncHttpClient c = getAsyncHttpClient(cg);
160+
AsyncHttpClient c = getAsyncHttpClient(null);
164161
try {
165162
Response response = c.preparePost(getTargetUrl()).setFollowRedirects(true).setHeader("X-redirect", "/foo/test").execute().get();
166163
assertNotNull(response);

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

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

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

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

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ public void testPutSmallFile() throws Exception {
6565
// int timeout = (5000);
6666
largeFile = createTempFile(bytes, (int) repeats);
6767

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

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

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

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

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

Lines changed: 4 additions & 5 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;
@@ -66,7 +65,7 @@ public org.eclipse.jetty.websocket.WebSocket doWebSocketConnect(HttpServletReque
6665

6766
@Test
6867
public void echoByte() throws Throwable {
69-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
68+
AsyncHttpClient c = getAsyncHttpClient(null);
7069
try {
7170
final CountDownLatch latch = new CountDownLatch(1);
7271
final AtomicReference<byte[]> text = new AtomicReference<byte[]>(new byte[0]);
@@ -110,7 +109,7 @@ public void onFragment(byte[] fragment, boolean last) {
110109

111110
@Test
112111
public void echoTwoMessagesTest() throws Throwable {
113-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
112+
AsyncHttpClient c = getAsyncHttpClient(null);
114113
try {
115114
final CountDownLatch latch = new CountDownLatch(2);
116115
final AtomicReference<byte[]> text = new AtomicReference<byte[]>(null);
@@ -161,7 +160,7 @@ public void onFragment(byte[] fragment, boolean last) {
161160

162161
@Test
163162
public void echoOnOpenMessagesTest() throws Throwable {
164-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
163+
AsyncHttpClient c = getAsyncHttpClient(null);
165164
try {
166165
final CountDownLatch latch = new CountDownLatch(2);
167166
final AtomicReference<byte[]> text = new AtomicReference<byte[]>(null);
@@ -210,7 +209,7 @@ public void onFragment(byte[] fragment, boolean last) {
210209
}
211210

212211
public void echoFragments() throws Exception {
213-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
212+
AsyncHttpClient c = getAsyncHttpClient(null);
214213
final CountDownLatch latch = new CountDownLatch(1);
215214
final AtomicReference<byte[]> text = new AtomicReference<byte[]>(null);
216215

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

Lines changed: 2 additions & 3 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 java.util.concurrent.CountDownLatch;
@@ -26,7 +25,7 @@ public abstract class CloseCodeReasonMessageTest extends TextMessageTest {
2625

2726
@Test(timeOut = 60000)
2827
public void onCloseWithCode() throws Throwable {
29-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
28+
AsyncHttpClient c = getAsyncHttpClient(null);
3029
try {
3130
final CountDownLatch latch = new CountDownLatch(1);
3231
final AtomicReference<String> text = new AtomicReference<String>("");
@@ -44,7 +43,7 @@ public void onCloseWithCode() throws Throwable {
4443

4544
@Test(timeOut = 60000)
4645
public void onCloseWithCodeServerClose() throws Throwable {
47-
AsyncHttpClient c = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
46+
AsyncHttpClient c = getAsyncHttpClient(null);
4847
try {
4948
final CountDownLatch latch = new CountDownLatch(1);
5049
final AtomicReference<String> text = new AtomicReference<String>("");

api/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>("");
@@ -357,7 +356,7 @@ public void onError(Throwable t) {
357356
}
358357

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

providers/grizzly/src/test/java/com/ning/http/client/providers/grizzly/GrizzlyConnectionPoolTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public void multipleMaxConnectionOpenTest() throws Throwable {
179179
public void win7DisconnectTest() throws Throwable {
180180
final AtomicInteger count = new AtomicInteger(0);
181181

182-
AsyncHttpClient client = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().build());
182+
AsyncHttpClient client = getAsyncHttpClient(null);
183183
try {
184184
AsyncCompletionHandler<Response> handler = new AsyncCompletionHandlerAdapter() {
185185

0 commit comments

Comments
 (0)