get Hostname Verifier for SSL - Android Network

Android examples for Network:HTTPS SSL

Description

get Hostname Verifier for SSL

Demo Code


//package com.java2s;

import javax.net.ssl.HostnameVerifier;

import javax.net.ssl.SSLSession;

public class Main {
    private static HostnameVerifier hostnameVerifier;

    private static HostnameVerifier getHostnameVerifier() {
        if (hostnameVerifier == null) {
            hostnameVerifier = new HostnameVerifier() {
                @Override/*from  w w w. j  av a2  s  . c o  m*/
                public boolean verify(String s, SSLSession sslSession) {
                    return true;
                }
            };
        }
        return hostnameVerifier;
    }
}

Related Tutorials