Code example for AllowAllHostnameVerifier

0
        super(null); 
        try { 
            SSLContext sslcontext = SSLContext.getInstance("TLS");
            sslcontext.init(null, new TrustManager[] {new TrustAllManager()}, null);
            factory = sslcontext.getSocketFactory();
            setHostnameVerifier(new AllowAllHostnameVerifier());
        } catch (Exception ex) {
        } 
    } 
 
    public static SocketFactory getDefault() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException {
        return new TrustAllSSLSocketFactory(); 
    } 
 
    @Override 
    public Socket createSocket() throws IOException {
        return factory.createSocket();
    } 
 
    @Override 
    public Socket createSocket(Socket socket, String s, int i, boolean flag) throws IOException {