Skip to content

Commit 3a91628

Browse files
committed
Replace "127.0.0.1" with "localhost"
1 parent 240b7d2 commit 3a91628

36 files changed

+95
-95
lines changed

client/src/test/java/org/asynchttpclient/AbstractBasicTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ public void tearDownGlobal() throws Exception {
5959
}
6060

6161
protected String getTargetUrl() {
62-
return String.format("http://127.0.0.1:%d/foo/test", port1);
62+
return String.format("http://localhost:%d/foo/test", port1);
6363
}
6464

6565
protected String getTargetUrl2() {
66-
return String.format("https://127.0.0.1:%d/foo/test", port2);
66+
return String.format("https://localhost:%d/foo/test", port2);
6767
}
6868

6969
public AbstractHandler configureHandler() throws Exception {

client/src/test/java/org/asynchttpclient/AuthTimeoutTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private Realm realm(boolean preemptive) {
189189

190190
@Override
191191
protected String getTargetUrl() {
192-
return "http://127.0.0.1:" + port1 + "/";
192+
return "http://localhost:" + port1 + "/";
193193
}
194194

195195
@Override

client/src/test/java/org/asynchttpclient/BasicAuthTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@ public void tearDownGlobal() throws Exception {
8181

8282
@Override
8383
protected String getTargetUrl() {
84-
return "http://127.0.0.1:" + port1 + "/";
84+
return "http://localhost:" + port1 + "/";
8585
}
8686

8787
@Override
8888
protected String getTargetUrl2() {
89-
return "http://127.0.0.1:" + port2 + "/uff";
89+
return "http://localhost:" + port2 + "/uff";
9090
}
9191

9292
protected String getTargetUrlNoAuth() {
93-
return "http://127.0.0.1:" + portNoAuth + "/";
93+
return "http://localhost:" + portNoAuth + "/";
9494
}
9595

9696
@Override

client/src/test/java/org/asynchttpclient/BasicHttpTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ public Response onCompleted(Response response) throws Exception {
643643

644644
@Test(groups = "standalone")
645645
public void asyncDoPostProxyTest() throws Exception {
646-
try (AsyncHttpClient client = asyncHttpClient(config().setProxyServer(proxyServer("127.0.0.1", port2).build()))) {
646+
try (AsyncHttpClient client = asyncHttpClient(config().setProxyServer(proxyServer("localhost", port2).build()))) {
647647
HttpHeaders h = new DefaultHttpHeaders();
648648
h.add(HttpHeaders.Names.CONTENT_TYPE, HttpHeaders.Values.APPLICATION_X_WWW_FORM_URLENCODED);
649649
StringBuilder sb = new StringBuilder();
@@ -686,7 +686,7 @@ public void asyncRequestVirtualServerPOSTTest() throws Exception {
686686
if (response.getHeader("X-Host").startsWith("localhost")) {
687687
assertEquals(response.getHeader("X-Host"), "localhost:" + port1);
688688
} else {
689-
assertEquals(response.getHeader("X-Host"), "127.0.0.1:" + port1);
689+
assertEquals(response.getHeader("X-Host"), "localhost:" + port1);
690690
}
691691
}
692692
}
@@ -848,7 +848,7 @@ public void asyncConnectInvalidFuture() throws Exception {
848848
final AtomicInteger count = new AtomicInteger();
849849
for (int i = 0; i < 20; i++) {
850850
try {
851-
Response response = client.preparePost(String.format("http://127.0.0.1:%d/", dummyPort)).execute(new AsyncCompletionHandlerAdapter() {
851+
Response response = client.preparePost(String.format("http://localhost:%d/", dummyPort)).execute(new AsyncCompletionHandlerAdapter() {
852852
@Override
853853
public void onThrowable(Throwable t) {
854854
count.incrementAndGet();
@@ -871,7 +871,7 @@ public void asyncConnectInvalidPortFuture() throws Exception {
871871
try (AsyncHttpClient client = asyncHttpClient()) {
872872
int dummyPort = findFreePort();
873873
try {
874-
Response response = client.preparePost(String.format("http://127.0.0.1:%d/", dummyPort)).execute(new AsyncCompletionHandlerAdapter() {
874+
Response response = client.preparePost(String.format("http://localhost:%d/", dummyPort)).execute(new AsyncCompletionHandlerAdapter() {
875875
@Override
876876
public void onThrowable(Throwable t) {
877877
t.printStackTrace();
@@ -894,7 +894,7 @@ public void asyncConnectInvalidPort() throws Exception {
894894
int port = findFreePort();
895895

896896
try {
897-
Response response = client.preparePost(String.format("http://127.0.0.1:%d/", port)).execute(new AsyncCompletionHandlerAdapter() {
897+
Response response = client.preparePost(String.format("http://localhost:%d/", port)).execute(new AsyncCompletionHandlerAdapter() {
898898
@Override
899899
public void onThrowable(Throwable t) {
900900
t.printStackTrace();
@@ -913,7 +913,7 @@ public void asyncConnectInvalidHandlerPort() throws Exception {
913913
final CountDownLatch l = new CountDownLatch(1);
914914
int port = findFreePort();
915915

916-
client.prepareGet(String.format("http://127.0.0.1:%d/", port)).execute(new AsyncCompletionHandlerAdapter() {
916+
client.prepareGet(String.format("http://localhost:%d/", port)).execute(new AsyncCompletionHandlerAdapter() {
917917
@Override
918918
public void onThrowable(Throwable t) {
919919
try {
@@ -963,7 +963,7 @@ public void asyncConnectInvalidFuturePort() throws Exception {
963963
int port = findFreePort();
964964

965965
try {
966-
Response response = client.prepareGet(String.format("http://127.0.0.1:%d/", port)).execute(new AsyncCompletionHandlerAdapter() {
966+
Response response = client.prepareGet(String.format("http://localhost:%d/", port)).execute(new AsyncCompletionHandlerAdapter() {
967967
@Override
968968
public void onThrowable(Throwable t) {
969969
called.set(true);
@@ -1363,7 +1363,7 @@ public void getShouldAllowBody() throws IOException {
13631363
@Test(groups = "standalone", expectedExceptions = NullPointerException.class)
13641364
public void invalidUri() throws Exception {
13651365
try (AsyncHttpClient client = asyncHttpClient()) {
1366-
client.prepareGet(String.format("http:127.0.0.1:%d/foo/test", port1)).build();
1366+
client.prepareGet(String.format("http:localhost:%d/foo/test", port1)).build();
13671367
}
13681368
}
13691369

@@ -1387,7 +1387,7 @@ public void mirrorByteTest() throws Exception {
13871387

13881388
@Test(groups = "standalone")
13891389
public void testNewConnectionEventsFired() throws Exception {
1390-
Request request = get("http://127.0.0.1:" + port1 + "/Test").build();
1390+
Request request = get("http://localhost:" + port1 + "/Test").build();
13911391

13921392
try (AsyncHttpClient client = asyncHttpClient()) {
13931393
EventCollectingHandler handler = new EventCollectingHandler();

client/src/test/java/org/asynchttpclient/BasicHttpsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
public class BasicHttpsTest extends AbstractBasicHttpsTest {
3939

4040
protected String getTargetUrl() {
41-
return String.format("https://127.0.0.1:%d/foo/test", port1);
41+
return String.format("https://localhost:%d/foo/test", port1);
4242
}
4343

4444
@Test(groups = "standalone")

client/src/test/java/org/asynchttpclient/ByteBufferCapacityTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@ public State onBodyPartReceived(final HttpResponseBodyPart content) throws Excep
9292
}
9393

9494
public String getTargetUrl() {
95-
return String.format("http://127.0.0.1:%d/foo/test", port1);
95+
return String.format("http://localhost:%d/foo/test", port1);
9696
}
9797
}

client/src/test/java/org/asynchttpclient/ComplexClientTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void multipleRequestsTest() throws Exception {
4545
public void urlWithoutSlashTest() throws Exception {
4646
try (AsyncHttpClient c = asyncHttpClient()) {
4747
String body = "hello there";
48-
Response response = c.preparePost(String.format("http://127.0.0.1:%d/foo/test", port1)).setBody(body).setHeader("Content-Type", "text/html").execute().get(TIMEOUT, TimeUnit.SECONDS);
48+
Response response = c.preparePost(String.format("http://localhost:%d/foo/test", port1)).setBody(body).setHeader("Content-Type", "text/html").execute().get(TIMEOUT, TimeUnit.SECONDS);
4949
assertEquals(response.getResponseBody(), body);
5050
}
5151
}

client/src/test/java/org/asynchttpclient/DigestAuthTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public AbstractHandler configureHandler() throws Exception {
6262
@Test(groups = "standalone")
6363
public void digestAuthTest() throws IOException, ExecutionException, TimeoutException, InterruptedException {
6464
try (AsyncHttpClient client = asyncHttpClient()) {
65-
Future<Response> f = client.prepareGet("http://127.0.0.1:" + port1 + "/")//
65+
Future<Response> f = client.prepareGet("http://localhost:" + port1 + "/")//
6666
.setRealm(digestAuthRealm(USER, ADMIN).setRealmName("MyRealm").build())//
6767
.execute();
6868
Response resp = f.get(60, TimeUnit.SECONDS);
@@ -75,7 +75,7 @@ public void digestAuthTest() throws IOException, ExecutionException, TimeoutExce
7575
@Test(groups = "standalone")
7676
public void digestAuthTestWithoutScheme() throws IOException, ExecutionException, TimeoutException, InterruptedException {
7777
try (AsyncHttpClient client = asyncHttpClient()) {
78-
Future<Response> f = client.prepareGet("http://127.0.0.1:" + port1 + "/")//
78+
Future<Response> f = client.prepareGet("http://localhost:" + port1 + "/")//
7979
.setRealm(digestAuthRealm(USER, ADMIN).setRealmName("MyRealm").build())//
8080
.execute();
8181
Response resp = f.get(60, TimeUnit.SECONDS);
@@ -88,7 +88,7 @@ public void digestAuthTestWithoutScheme() throws IOException, ExecutionException
8888
@Test(groups = "standalone")
8989
public void digestAuthNegativeTest() throws IOException, ExecutionException, TimeoutException, InterruptedException {
9090
try (AsyncHttpClient client = asyncHttpClient()) {
91-
Future<Response> f = client.prepareGet("http://127.0.0.1:" + port1 + "/")//
91+
Future<Response> f = client.prepareGet("http://localhost:" + port1 + "/")//
9292
.setRealm(digestAuthRealm("fake", ADMIN).build())//
9393
.execute();
9494
Response resp = f.get(20, TimeUnit.SECONDS);

client/src/test/java/org/asynchttpclient/ErrorResponseTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public AbstractHandler configureHandler() throws Exception {
6363
@Test(groups = "standalone")
6464
public void testQueryParameters() throws Exception {
6565
try (AsyncHttpClient client = asyncHttpClient()) {
66-
Future<Response> f = client.prepareGet("http://127.0.0.1:" + port1 + "/foo").addHeader("Accepts", "*/*").execute();
66+
Future<Response> f = client.prepareGet("http://localhost:" + port1 + "/foo").addHeader("Accepts", "*/*").execute();
6767
Response resp = f.get(3, TimeUnit.SECONDS);
6868
assertNotNull(resp);
6969
assertEquals(resp.getStatusCode(), 400);

client/src/test/java/org/asynchttpclient/Expect100ContinueTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public AbstractHandler configureHandler() throws Exception {
6161
@Test(groups = "standalone")
6262
public void Expect100Continue() throws Exception {
6363
try (AsyncHttpClient client = asyncHttpClient()) {
64-
Future<Response> f = client.preparePut("http://127.0.0.1:" + port1 + "/").setHeader("Expect", "100-continue").setBody(SIMPLE_TEXT_FILE).execute();
64+
Future<Response> f = client.preparePut("http://localhost:" + port1 + "/").setHeader("Expect", "100-continue").setBody(SIMPLE_TEXT_FILE).execute();
6565
Response resp = f.get();
6666
assertNotNull(resp);
6767
assertEquals(resp.getStatusCode(), HttpServletResponse.SC_OK);

0 commit comments

Comments
 (0)