test/jdk/com/sun/net/httpserver/TestLogging.java
changeset 55330 1fef7d9309a9
parent 54314 46cf212cdcca
--- a/test/jdk/com/sun/net/httpserver/TestLogging.java	Mon Jun 10 10:11:42 2019 +0100
+++ b/test/jdk/com/sun/net/httpserver/TestLogging.java	Tue Jun 11 15:46:26 2019 +0100
@@ -26,6 +26,8 @@
  * @bug 6422914
  * @library /test/lib
  * @summary change httpserver exception printouts
+ * @run main TestLogging
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true TestLogging
  */
 
 import com.sun.net.httpserver.*;
@@ -49,7 +51,8 @@
         try {
             System.out.print ("Test9: ");
             String root = System.getProperty ("test.src")+ "/docs";
-            InetSocketAddress addr = new InetSocketAddress (0);
+            InetAddress loopback = InetAddress.getLoopbackAddress();
+            InetSocketAddress addr = new InetSocketAddress(loopback, 0);
             Logger logger = Logger.getLogger ("com.sun.net.httpserver");
             logger.setLevel (Level.ALL);
             Handler h1 = new ConsoleHandler ();
@@ -70,9 +73,9 @@
                 .loopback()
                 .port(p1)
                 .path("/test1/smallfile.txt")
-                .toURLUnchecked();
+                .toURL();
             System.out.println("URL: " + url);
-            HttpURLConnection urlc = (HttpURLConnection)url.openConnection();
+            HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY);
             InputStream is = urlc.getInputStream();
             while (is.read() != -1) ;
             is.close();