test/jdk/sun/net/www/protocol/http/RedirectOnPost.java
changeset 55045 3a8433d967ea
parent 54314 46cf212cdcca
equal deleted inserted replaced
55044:d3afe760b392 55045:3a8433d967ea
     1 /*
     1 /*
     2  * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   163     }
   163     }
   164 
   164 
   165     private static HttpServer getHttpServer(ExecutorService execs)
   165     private static HttpServer getHttpServer(ExecutorService execs)
   166         throws Exception
   166         throws Exception
   167     {
   167     {
   168         InetSocketAddress inetAddress = new InetSocketAddress(0);
   168         InetSocketAddress inetAddress = new InetSocketAddress(
       
   169                 InetAddress.getLoopbackAddress(), 0);
   169         HttpServer testServer = HttpServer.create(inetAddress, 15);
   170         HttpServer testServer = HttpServer.create(inetAddress, 15);
   170         int port = testServer.getAddress().getPort();
   171         int port = testServer.getAddress().getPort();
   171         testServer.setExecutor(execs);
   172         testServer.setExecutor(execs);
   172 
   173 
   173         HttpContext context = testServer.createContext("/test");
   174         HttpContext context = testServer.createContext("/test");
   178     private static HttpsServer getHttpsServer(
   179     private static HttpsServer getHttpsServer(
   179         ExecutorService execs, SSLContext ctx
   180         ExecutorService execs, SSLContext ctx
   180     )
   181     )
   181         throws Exception
   182         throws Exception
   182     {
   183     {
   183         InetSocketAddress inetAddress = new InetSocketAddress(0);
   184         InetSocketAddress inetAddress = new InetSocketAddress(
       
   185                 InetAddress.getLoopbackAddress(), 0);
   184         HttpsServer testServer = HttpsServer.create(inetAddress, 15);
   186         HttpsServer testServer = HttpsServer.create(inetAddress, 15);
   185         int port = testServer.getAddress().getPort();
   187         int port = testServer.getAddress().getPort();
   186         testServer.setExecutor(execs);
   188         testServer.setExecutor(execs);
   187         testServer.setHttpsConfigurator(new HttpsConfigurator (ctx));
   189         testServer.setHttpsConfigurator(new HttpsConfigurator (ctx));
   188 
   190