Code example for HostNameResolver

Methods: resolve

0
        int connTimeout = HttpConnectionParams.getConnectionTimeout(params);
        int soTimeout = HttpConnectionParams.getSoTimeout(params);
 
        InetSocketAddress remoteAddress;
        if (this.nameResolver != null) {
            remoteAddress = new InetSocketAddress(this.nameResolver.resolve(host), port); 
        } else { 
            remoteAddress = new InetSocketAddress(host, port);            
        } 
         
        sslsock.connect(remoteAddress, connTimeout);
 
        sslsock.setSoTimeout(soTimeout);
        try { 
            hostnameVerifier.verify(host, sslsock);
            // verifyHostName() didn't blowup - good! 
        } catch (IOException iox) {
            // close the socket before re-throwing the exception 
            try { sslsock.close(); } catch (Exception x) { /*ignore*/ }
            throw iox;
        }