Package javax.net.ssl

Examples of javax.net.ssl.HttpsURLConnection$DefaultHostnameVerifier


    public HttpsTransport(TextWireFormat wireFormat, URI remoteUrl) throws MalformedURLException {
        super(wireFormat, remoteUrl);
    }

    protected synchronized HttpURLConnection createSendConnection() throws IOException {
        HttpsURLConnection conn = (HttpsURLConnection) getRemoteURL().openConnection();
        conn.setDoOutput(true);
        conn.setRequestMethod("POST");
        configureConnection(conn);
        conn.connect();
        return conn;
    }
View Full Code Here


        conn.connect();
        return conn;
    }

    protected synchronized HttpURLConnection createReceiveConnection() throws IOException {
        HttpsURLConnection conn = (HttpsURLConnection) getRemoteURL().openConnection();
        conn.setDoOutput(false);
        conn.setDoInput(true);
        conn.setRequestMethod("GET");
        configureConnection(conn);
        conn.connect();
        return conn;
    }
View Full Code Here

            verifier = CertificateHostnameVerifier.DEFAULT;
        }
       
        if (connection instanceof HttpsURLConnection) {
            // handle the expected case (javax.net.ssl)
            HttpsURLConnection conn = (HttpsURLConnection) connection;
            conn.setHostnameVerifier(verifier);
            conn.setSSLSocketFactory(socketFactory);
        } else {
            // handle the deprecated sun case and other possible hidden API's
            // that are similar to the Sun cases
            try {
                Method method = connection.getClass().getMethod("getHostnameVerifier");
View Full Code Here

        HostnameVerifier hv = null;
        boolean bypassHostnameVerification =
            ((ClientConfig)request.getAttribute(WinkConfiguration.class))
                .getBypassHostnameVerification() && (connection instanceof HttpsURLConnection);
        if (bypassHostnameVerification) {
            HttpsURLConnection https = ((HttpsURLConnection)connection);
            hv = https.getHostnameVerifier();
            https.setHostnameVerifier(new HostnameVerifier() {
                public boolean verify(String urlHostName, SSLSession session) {
                    logger.trace("Bypassing hostname verification: URL host is " + urlHostName //$NON-NLS-1$
                        + ", SSLSession host is " //$NON-NLS-1$
                        + session.getPeerHost());
                    return true;
View Full Code Here

*
*/
public class HttpsURLConnectionTest extends TestCase {

    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) {
        }
    }
View Full Code Here

        } catch (SSLPeerUnverifiedException e) {
        }
    }

    public final void testGetLocalPrincipal() {
        HttpsURLConnection con = new MyHttpsURLConnection(null);
        if (con.getLocalPrincipal() != null) {
            fail("Non null result");
        }
    }
View Full Code Here

        } catch (IllegalArgumentException e) {
        }
    }

    public final void testSetHostnameVerifier() {
        HttpsURLConnection con = new MyHttpsURLConnection(null);
        try {
            con.setHostnameVerifier(null);
            fail("No expected IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        }
    }
View Full Code Here

            fail("incorrect DefaultSSLSocketFactory");
        }
    }

    public final void testGetSSLSocketFactory() {
        HttpsURLConnection con = new MyHttpsURLConnection(null);
        SSLSocketFactory sf = con.getSSLSocketFactory();
        if (!sf.equals(SSLSocketFactory.getDefault())) {
            fail("incorrect DefaultSSLSocketFactory");
        }
    }
View Full Code Here

        } catch (IllegalArgumentException e) {
        }
    }

    public final void testSetSSLSocketFactory() {
        HttpsURLConnection con = new MyHttpsURLConnection(null);
        try {
            con.setSSLSocketFactory(null);
            fail("No expected IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        }
    }
View Full Code Here

            verifier = CertificateHostnameVerifier.DEFAULT;
        }
       
        if (connection instanceof HttpsURLConnection) {
            // handle the expected case (javax.net.ssl)
            HttpsURLConnection conn = (HttpsURLConnection) connection;
            conn.setHostnameVerifier(verifier);
            conn.setSSLSocketFactory(socketFactory);
        } else {
            // handle the deprecated sun case and other possible hidden API's
            // that are similar to the Sun cases
            try {
                Method method = connection.getClass().getMethod("getHostnameVerifier");
View Full Code Here

TOP

Related Classes of javax.net.ssl.HttpsURLConnection$DefaultHostnameVerifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.