test/jdk/sun/net/www/protocol/https/HttpsURLConnection/IPAddressDNSIdentities.java
changeset 54314 46cf212cdcca
parent 47216 71c04702a3d5
child 58108 5302477c8285
equal deleted inserted replaced
54313:440cbcf3b268 54314:46cf212cdcca
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /* @test
    24 /* @test
    25  * @bug 6766775
    25  * @bug 6766775
       
    26  * @library /test/lib
    26  * @summary X509 certificate hostname checking is broken in JDK1.6.0_10
    27  * @summary X509 certificate hostname checking is broken in JDK1.6.0_10
    27  * @run main/othervm IPAddressDNSIdentities
    28  * @run main/othervm IPAddressDNSIdentities
    28  *
    29  *
    29  *     SunJSSE does not support dynamic system properties, no way to re-use
    30  *     SunJSSE does not support dynamic system properties, no way to re-use
    30  *     system properties in samevm/agentvm mode.
    31  *     system properties in samevm/agentvm mode.
    40 import java.security.cert.Certificate;
    41 import java.security.cert.Certificate;
    41 import java.security.cert.CertificateFactory;
    42 import java.security.cert.CertificateFactory;
    42 import java.security.spec.*;
    43 import java.security.spec.*;
    43 import java.security.interfaces.*;
    44 import java.security.interfaces.*;
    44 import java.math.BigInteger;
    45 import java.math.BigInteger;
       
    46 import jdk.test.lib.net.URIBuilder;
    45 
    47 
    46 /*
    48 /*
    47  * Certificates and key used in the test.
    49  * Certificates and key used in the test.
    48  *
    50  *
    49  * TLS server certificate:
    51  * TLS server certificate:
   708             }
   710             }
   709 
   711 
   710             HttpsURLConnection http = null;
   712             HttpsURLConnection http = null;
   711 
   713 
   712             /* establish http connection to server */
   714             /* establish http connection to server */
   713             URL url = new URL("https://127.0.0.1:" + serverPort+"/");
   715             URL url = URIBuilder.newBuilder()
       
   716                 .scheme("https")
       
   717                 .loopback()
       
   718                 .port(serverPort)
       
   719                 .path("/")
       
   720                 .toURL();
   714             System.out.println("url is "+url.toString());
   721             System.out.println("url is "+url.toString());
   715 
   722 
   716             try {
   723             try {
   717                 http = (HttpsURLConnection)url.openConnection();
   724                 http = (HttpsURLConnection)url.openConnection();
   718 
   725