test/jdk/sun/net/www/protocol/http/B6890349.java
changeset 54314 46cf212cdcca
parent 47216 71c04702a3d5
child 55512 61e03d5d6bcb
equal deleted inserted replaced
54313:440cbcf3b268 54314:46cf212cdcca
    37             ServerSocket server = new ServerSocket (0);
    37             ServerSocket server = new ServerSocket (0);
    38             int port = server.getLocalPort();
    38             int port = server.getLocalPort();
    39             System.out.println ("listening on "  + port);
    39             System.out.println ("listening on "  + port);
    40             B6890349 t = new B6890349 (server);
    40             B6890349 t = new B6890349 (server);
    41             t.start();
    41             t.start();
    42             URL u = new URL ("http://127.0.0.1:"+port+"/foo\nbar");
    42             URL u = new URL("http",
       
    43                 InetAddress.getLoopbackAddress().getHostAddress(),
       
    44                 port,
       
    45                 "/foo\nbar");
       
    46             System.out.println("URL: " + u);
    43             HttpURLConnection urlc = (HttpURLConnection)u.openConnection ();
    47             HttpURLConnection urlc = (HttpURLConnection)u.openConnection ();
    44             InputStream is = urlc.getInputStream();
    48             InputStream is = urlc.getInputStream();
    45             throw new RuntimeException ("Test failed");
    49             throw new RuntimeException ("Test failed");
    46         } catch (IOException e) {
    50         } catch (IOException e) {
    47             System.out.println ("OK");
    51             System.out.println ("OK");