Lines 402-411
Link Here
|
402 |
URL url = new URL("http", "localhost", HTTP_SERVER_PORT, "/"); |
402 |
URL url = new URL("http", "localhost", HTTP_SERVER_PORT, "/"); |
403 |
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); |
403 |
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); |
404 |
conn.addRequestProperty("X-Sleep", "1000"); |
404 |
conn.addRequestProperty("X-Sleep", "1000"); |
405 |
conn.connect(); |
|
|
406 |
// use nanoTime to do timing measurement or calculation |
405 |
// use nanoTime to do timing measurement or calculation |
407 |
// See https://blogs.oracle.com/dholmes/entry/inside_the_hotspot_vm_clocks |
406 |
// See https://blogs.oracle.com/dholmes/entry/inside_the_hotspot_vm_clocks |
408 |
long now = System.nanoTime(); |
407 |
long now = System.nanoTime(); |
|
|
408 |
conn.connect(); |
409 |
final InputStream inputStream = conn.getInputStream(); |
409 |
final InputStream inputStream = conn.getInputStream(); |
410 |
while(inputStream.read() != -1) {} |
410 |
while(inputStream.read() != -1) {} |
411 |
inputStream.close(); |
411 |
inputStream.close(); |