Code example for HttpsURLConnection

Methods: getPeerPrincipal

0
 
    public final void testGetPeerPrincipal() throws Exception { 
        HttpsURLConnection con = new MyHttpsURLConnection(new URL(
                "http://foo.com")); 
        try { 
            con.getPeerPrincipal();
            fail("No expected SSLPeerUnverifiedException");
        } catch (SSLPeerUnverifiedException e) {
        } 
    } 
 
    public final void testGetLocalPrincipal() { 
        HttpsURLConnection con = new MyHttpsURLConnection(null);
        if (con.getLocalPrincipal() != null) {
            fail("Non null result");
        } 
    } 
 
    public final void testSetDefaultHostnameVerifier() { 
        try {