Skip to content

Commit

Permalink
yegor256#306: change HttpConnection by JdkRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
lautarobock committed Jun 26, 2015
1 parent c699c9b commit ffc3ace
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/test/java/org/takes/http/BkBasicTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import java.net.InetAddress;
import java.net.Socket;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
Expand Down Expand Up @@ -111,7 +110,7 @@ public void handlesSocket() throws IOException {
})
public void handlesPersistentConnection() throws Exception {
final int port = new Ports().allocate();
final String uri = String.format("http://localhost:%d/pepe", port);
final String uri = String.format("http://localhost:%d", port);
// @checkstyle MagicNumberCheck (1 line)
final int count = 1;
final CountDownLatch completed = new CountDownLatch(count);
Expand Down Expand Up @@ -148,14 +147,11 @@ public boolean ready() {
);
thread.start();
for (int idx = 0; idx < 2; ++idx) {
final HttpURLConnection conn = HttpURLConnection.class.cast(
new URL(uri).openConnection()
);
conn.setRequestMethod("HEAD");
conn.setUseCaches(false);
conn.setInstanceFollowRedirects(false);
conn.addRequestProperty("Host", "localhost");
conn.getHeaderFields();
new JdkRequest(uri)
.method("HEAD")
.fetch()
.as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK);
}
completed.countDown();
// @checkstyle MagicNumberCheck (1 line)
Expand Down

0 comments on commit ffc3ace

Please sign in to comment.