< prev index next >
test/jdk/java/net/httpclient/LargeResponseContent.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 57,68 ****
serverThread.setDaemon(false);
port = server.getLocalPort();
serverThread.start();
}
void runClient() throws IOException, InterruptedException {
! URI uri = URI.create("http://127.0.0.1:" + Integer.toString(port) + "/foo");
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(uri)
.GET()
.build();
HttpResponse<Long> response = client.send(request, new ClientHandler());
--- 57,73 ----
serverThread.setDaemon(false);
port = server.getLocalPort();
serverThread.start();
}
+ final String serverAuthority() {
+ return InetAddress.getLoopbackAddress().getHostName() + ":"
+ + server.getLocalPort();
+ }
+
void runClient() throws IOException, InterruptedException {
! URI uri = URI.create("http://" + serverAuthority() + "/foo");
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(uri)
.GET()
.build();
HttpResponse<Long> response = client.send(request, new ClientHandler());
< prev index next >