equal
deleted
inserted
replaced
22 */ |
22 */ |
23 |
23 |
24 /** |
24 /** |
25 * @test |
25 * @test |
26 * @bug 6422914 |
26 * @bug 6422914 |
|
27 * @library /test/lib |
27 * @summary change httpserver exception printouts |
28 * @summary change httpserver exception printouts |
28 */ |
29 */ |
29 |
30 |
30 import com.sun.net.httpserver.*; |
31 import com.sun.net.httpserver.*; |
31 |
32 |
35 import java.io.*; |
36 import java.io.*; |
36 import java.net.*; |
37 import java.net.*; |
37 import java.security.*; |
38 import java.security.*; |
38 import java.security.cert.*; |
39 import java.security.cert.*; |
39 import javax.net.ssl.*; |
40 import javax.net.ssl.*; |
|
41 import jdk.test.lib.net.URIBuilder; |
40 |
42 |
41 public class TestLogging extends Test { |
43 public class TestLogging extends Test { |
42 |
44 |
43 public static void main (String[] args) throws Exception { |
45 public static void main (String[] args) throws Exception { |
44 HttpServer s1 = null; |
46 HttpServer s1 = null; |
61 s1.setExecutor (executor); |
63 s1.setExecutor (executor); |
62 s1.start(); |
64 s1.start(); |
63 |
65 |
64 int p1 = s1.getAddress().getPort(); |
66 int p1 = s1.getAddress().getPort(); |
65 |
67 |
66 URL url = new URL ("http://127.0.0.1:"+p1+"/test1/smallfile.txt"); |
68 URL url = URIBuilder.newBuilder() |
|
69 .scheme("http") |
|
70 .loopback() |
|
71 .port(p1) |
|
72 .path("/test1/smallfile.txt") |
|
73 .toURLUnchecked(); |
|
74 System.out.println("URL: " + url); |
67 HttpURLConnection urlc = (HttpURLConnection)url.openConnection(); |
75 HttpURLConnection urlc = (HttpURLConnection)url.openConnection(); |
68 InputStream is = urlc.getInputStream(); |
76 InputStream is = urlc.getInputStream(); |
69 while (is.read() != -1) ; |
77 while (is.read() != -1) ; |
70 is.close(); |
78 is.close(); |
71 |
79 |
72 url = new URL ("http://127.0.0.1:"+p1+"/test1/doesntexist.txt"); |
80 url = URIBuilder.newBuilder() |
|
81 .scheme("http") |
|
82 .loopback() |
|
83 .port(p1) |
|
84 .path("/test1/doesntexist.txt") |
|
85 .toURLUnchecked(); |
|
86 System.out.println("URL: " + url); |
73 urlc = (HttpURLConnection)url.openConnection(); |
87 urlc = (HttpURLConnection)url.openConnection(); |
74 try { |
88 try { |
75 is = urlc.getInputStream(); |
89 is = urlc.getInputStream(); |
76 while (is.read() != -1) ; |
90 while (is.read() != -1) ; |
77 is.close(); |
91 is.close(); |