equal
deleted
inserted
replaced
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /** |
24 /** |
25 * @test |
25 * @test |
|
26 * @library /test/lib |
26 * @bug 6401598 |
27 * @bug 6401598 |
27 * @summary new HttpServer cannot serve binary stream data |
28 * @summary new HttpServer cannot serve binary stream data |
28 */ |
29 */ |
29 |
30 |
30 import java.io.*; |
31 import java.io.*; |
31 import java.net.HttpURLConnection; |
32 import java.net.HttpURLConnection; |
32 import java.net.MalformedURLException; |
33 import java.net.MalformedURLException; |
33 import java.net.URL; |
34 import java.net.URL; |
|
35 import java.net.InetAddress; |
34 import java.net.InetSocketAddress; |
36 import java.net.InetSocketAddress; |
35 import java.util.concurrent.*; |
37 import java.util.concurrent.*; |
|
38 |
|
39 import jdk.test.lib.net.URIBuilder; |
36 |
40 |
37 import com.sun.net.httpserver.HttpExchange; |
41 import com.sun.net.httpserver.HttpExchange; |
38 import com.sun.net.httpserver.HttpHandler; |
42 import com.sun.net.httpserver.HttpHandler; |
39 import com.sun.net.httpserver.HttpServer; |
43 import com.sun.net.httpserver.HttpServer; |
40 |
44 |
88 server.start(); |
92 server.start(); |
89 |
93 |
90 short counter; |
94 short counter; |
91 |
95 |
92 for (counter = 0; counter < 1000; counter++) { |
96 for (counter = 0; counter < 1000; counter++) { |
93 HttpURLConnection connection = getHttpURLConnection(new URL("http://127.0.0.1:"+port+"/server/"), 10000); |
97 URL url = URIBuilder.newBuilder() |
|
98 .scheme("http") |
|
99 .loopback() |
|
100 .port(port) |
|
101 .path("/server/") |
|
102 .toURLUnchecked(); |
|
103 System.out.println("URL: " + url); |
|
104 HttpURLConnection connection = getHttpURLConnection(url, 10000); |
94 |
105 |
95 OutputStream os = connection.getOutputStream(); |
106 OutputStream os = connection.getOutputStream(); |
96 |
107 |
97 DataOutputStream dos = new DataOutputStream(os); |
108 DataOutputStream dos = new DataOutputStream(os); |
98 |
109 |