Code example for SSLPeerUnverifiedException

        // TODO: Instead of reporting the name of the server we think we're connecting to, 
        // we should be reporting the bad name in the certificate.  Unfortunately this is buried 
        // in the verifier code and is not available in the verifier API, and extracting the 
        // CN & alts is beyond the scope of this patch. 
        if (!HOSTNAME_VERIFIER.verify(hostname, session)) {
            throw new SSLPeerUnverifiedException(
                    "Certificate hostname not useable for server: " + hostname);
     * Set the socket timeout. 
     * @param timeoutMilliseconds the read timeout value if greater than {@code 0}, or 
     *            {@code 0} for an infinite timeout. 
    public void setSoTimeout(int timeoutMilliseconds) throws SocketException {
Contextual code suggestions in your IDE  Get Codota for Java