--- a/test/jdk/java/net/URLConnection/Responses.java Wed Sep 04 17:36:53 2019 +0100
+++ b/test/jdk/java/net/URLConnection/Responses.java Wed Sep 04 18:10:07 2019 +0100
@@ -56,7 +56,8 @@
* "HTTP/1.1 404 "
*/
static class HttpServer implements Runnable {
- ServerSocket ss;
+ final ServerSocket ss;
+ volatile boolean shutdown;
public HttpServer() {
try {
@@ -83,6 +84,7 @@
}
public void shutdown() throws IOException {
+ shutdown = true;
ss.close();
}
@@ -90,7 +92,7 @@
Object[][] tests = getTests();
try {
- for (;;) {
+ while(!shutdown) {
Socket s = ss.accept();
BufferedReader in = new BufferedReader(
@@ -101,6 +103,7 @@
int pos2 = req.indexOf(' ', pos1+1);
int i = Integer.parseInt(req.substring(pos1+2, pos2));
+ System.out.println("Server replying to >" + tests[i][0] + "<");
PrintStream out = new PrintStream(
new BufferedOutputStream(
@@ -117,6 +120,9 @@
s.close();
}
} catch (Exception e) {
+ if (!shutdown) {
+ e.printStackTrace();
+ }
}
}
}
@@ -170,6 +176,7 @@
actualPhrase + ", expected: " + expectedPhrase);
}
} catch (IOException e) {
+ System.err.println("Test failed for >" + tests[i][0] + "<: " + e);
e.printStackTrace();
failures++;
}