< prev index next >

test/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java

Print this page

        

*** 29,50 **** /* * @test * @bug 6216082 * @summary Redirect problem with HttpsURLConnection using a proxy * @modules java.base/sun.net.www ! * @library .. * @build HttpCallback TestHttpsServer ClosedChannelList ! * HttpTransaction TunnelProxy * @key intermittent * @run main/othervm B6216082 */ import java.io.*; import java.net.*; import javax.net.ssl.*; import java.util.*; public class B6216082 { static SimpleHttpTransaction httpTrans; static TestHttpsServer server; static TunnelProxy proxy; --- 29,52 ---- /* * @test * @bug 6216082 * @summary Redirect problem with HttpsURLConnection using a proxy * @modules java.base/sun.net.www ! * @library .. /lib/testlibrary * @build HttpCallback TestHttpsServer ClosedChannelList ! * HttpTransaction TunnelProxy jdk.testlibrary.NetworkConfiguration * @key intermittent * @run main/othervm B6216082 */ import java.io.*; import java.net.*; import javax.net.ssl.*; import java.util.*; + import jdk.testlibrary.NetworkConfiguration; + public class B6216082 { static SimpleHttpTransaction httpTrans; static TestHttpsServer server; static TunnelProxy proxy;
*** 116,140 **** HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier()); return true; } public static InetAddress getNonLoAddress() throws Exception { ! NetworkInterface loNIC = NetworkInterface.getByInetAddress(InetAddress.getByName("localhost")); ! Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces(); ! while (nics.hasMoreElements()) { ! NetworkInterface nic = nics.nextElement(); ! if (!nic.getName().equalsIgnoreCase(loNIC.getName())) { ! Enumeration<InetAddress> addrs = nic.getInetAddresses(); ! while (addrs.hasMoreElements()) { ! InetAddress addr = addrs.nextElement(); ! if (!addr.isLoopbackAddress()) ! return addr; ! } ! } ! } ! return null; } public static void startHttpServer() throws IOException { // Both the https server and the proxy let the // system pick up an ephemeral port. --- 118,138 ---- HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier()); return true; } public static InetAddress getNonLoAddress() throws Exception { ! InetAddress lh = InetAddress.getByName("localhost"); ! NetworkInterface loNIC = NetworkInterface.getByInetAddress(lh); ! ! NetworkConfiguration nc = NetworkConfiguration.probe(); ! Optional<InetAddress> oaddr = nc.interfaces() ! .filter(nif -> !nif.getName().equalsIgnoreCase(loNIC.getName())) ! .flatMap(nif -> nc.addresses(nif)) ! .filter(a -> !a.isLoopbackAddress()) ! .findFirst(); ! return oaddr.orElseGet(() -> null); } public static void startHttpServer() throws IOException { // Both the https server and the proxy let the // system pick up an ephemeral port.
< prev index next >