Package javax.net.ssl

Examples of javax.net.ssl.HostnameVerifier


                if ("HTTPS".equalsIgnoreCase(url.getProtocol())) {
                    HttpsURLConnection scon = (HttpsURLConnection) con;
                    try {
                        scon.setSSLSocketFactory(SSLUtil.getSSLSocketFactory(clientCertAlias, trustAnyCert));
                        HostnameVerifier hv = SSLUtil.getHostnameVerifier(hostCertLevel);
                        if (hv != null) {
                            scon.setHostnameVerifier(hv);
                        }
                    } catch (GeneralSecurityException e) {
                        Debug.logError(e, module);
View Full Code Here


             * N.B. does not allow SlowSocket - fails with:
             * java.lang.RuntimeException: Export restriction: this JSSE implementation is non-pluggable.
             */

            HttpsURLConnection.setDefaultSSLSocketFactory(new HttpSSLProtocolSocketFactory(this));
            HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
                public boolean verify(String hostname, SSLSession session) {
                    return true;
                }
            });

View Full Code Here

import simple.schema.client.Ping;

public class PingServiceClient {
   
    public static void main (String[] args) {
            HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
                public boolean verify(String string, SSLSession sSLSession) {
                    return true;
                }
            });
           
View Full Code Here

    public static void setupSecurity(String pathToCertDir){
        LOG.debug("Setting up security...");
        /* needed for disabling hostname verification
         * if hostname is different from the one in the host certificate
         */
        HostnameVerifier hv = new HostnameVerifier() {
            public boolean verify(String arg0, SSLSession arg1) {
                    return true;
            }
        };
        HttpsURLConnection.setDefaultHostnameVerifier(hv);
View Full Code Here

    try {
      SSLContext sslContext = SSLContext.getInstance("SSL");
      sslContext.init( null, trustAllCerts, new java.security.SecureRandom() );
        SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
      ((HttpsURLConnection) connection).setSSLSocketFactory(sslSocketFactory);
      ((HttpsURLConnection) connection).setHostnameVerifier(new HostnameVerifier() {
         
        public boolean verify(String arg0, SSLSession arg1) {
          return true;
        }
         
View Full Code Here

    try {
      SSLContext sslContext = SSLContext.getInstance("SSL");
      sslContext.init( null, trustAllCerts, new java.security.SecureRandom() );
        SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
      ((HttpsURLConnection) connection).setSSLSocketFactory(sslSocketFactory);
      ((HttpsURLConnection) connection).setHostnameVerifier(new HostnameVerifier() {
         
        public boolean verify(String arg0, SSLSession arg1) {
          return true;
        }
         
View Full Code Here

   */
  public static InputStream post(URL url, String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4) throws IOException {
    return new ClientHttpRequest(url).post(name1, value1, name2, value2, name3, value3, name4, value4);
  }
  public static void main(String[] args) throws MalformedURLException, IOException {
    HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
        public boolean verify(String urlHostName, SSLSession session) {
            return true;
        }
    });
    System.setProperty("sun.net.client.defaultConnectTimeout", "4000");
View Full Code Here

                sslContext.init(null, trustAllCerts, new SecureRandom());

                // Create an ssl socket factory with our all-trusting manager
                final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
                HttpsURLConnection.setDefaultSSLSocketFactory( sslSocketFactory );
                sc.setHostnameVerifier(new HostnameVerifier()
                {
                    public boolean verify(String s, SSLSession sslSession)
                    {
                        return true;
                    }
                });
                HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier()
                {
                    public boolean verify(String hostname, SSLSession session)
                    {
                        return true;
                    }
View Full Code Here

            proxy = new Proxy(java.net.Proxy.Type.HTTP, new InetSocketAddress(proxyServer, port));
        }

        //  If we are trusting all ssl connections\
        SSLSocketFactory factory = null;
        HostnameVerifier verifier = null;
        if (ignoreSec && url.startsWith("https"))
        {
            factory = buildNaiveSSLSocketFactory();
            verifier = NAIVE_VERIFIER;
        }
View Full Code Here

    public static URLConnection getConnection(URL url, String proxyServer, int port, Map inCookies, boolean input, boolean output, boolean cache, boolean ignoreSec) throws IOException
    {
        Proxy proxy = (proxyServer == null) ?  Proxy.NO_PROXY : new Proxy(java.net.Proxy.Type.HTTP, new InetSocketAddress(proxyServer, port));
        SSLSocketFactory sslFactory = ignoreSec ? buildNaiveSSLSocketFactory() : null;
        HostnameVerifier verifier = ignoreSec ? NAIVE_VERIFIER : null;
        return getConnection(url, inCookies, input, output, cache, proxy, sslFactory, verifier);
    }
View Full Code Here

TOP

Related Classes of javax.net.ssl.HostnameVerifier

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.