Java 8 SSLPeerUnverifiedException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 SSLPeerUnverifiedException class.

This code example shows how to use the following methods:getCause, getMessage
     * Assertion: constructs SSLPeerUnverifiedException when <code>msg</code> 
     * is null 
     */ 
    public void testSSLPeerUnverifiedException02() { 
        String msg = null;
        SSLPeerUnverifiedException tE = new SSLPeerUnverifiedException(msg);
        assertNull("getMessage() must return null.", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
    } 
} 
6
CodeRank
This code example shows how to use the following methods:
        // 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. 
     */ 
    @Override 
    public void setSoTimeout(int timeoutMilliseconds) throws SocketException {
        mSocket.setSoTimeout(timeoutMilliseconds);
    } 
 
5
CodeRank
This code example shows how to use the following methods:
            "Long message for Exception. Long message for Exception. Long message for Exception." }; 
 
    @Override 
    protected Object[] getData() { 
        return new Object[] { new SSLPeerUnverifiedException(null), 
                new SSLPeerUnverifiedException(msgs[0]), new SSLPeerUnverifiedException(msgs[1]) }; 
    } 
 
} 
5
CodeRank
This code example shows how to use the following methods:
        return 12345; 
    } 
 
    public Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException {
        if (certs == null) {
            throw new SSLPeerUnverifiedException("peer not authenticated");
        } else { 
            return certs;
        } 
    } 
 
    public X509Certificate[] getPeerCertificateChain() throws SSLPeerUnverifiedException {
        if(xCerts == null) {
            throw new SSLPeerUnverifiedException("peer not authenticated");
        } else { 
            return xCerts;
        } 
    } 
 
    public String getPeerHost() {
5
CodeRank
This code example shows how to use the following methods:
    /* 
     * @see javax.net.ssl.SSLSession#getPeerCertificateChain() 
     */ 
    public X509Certificate[] getPeerCertificateChain()
    throws SSLPeerUnverifiedException { 
        throw new SSLPeerUnverifiedException("test exception");
    } 
 
    /* 
     * @see javax.net.ssl.SSLSession#getPeerCertificates() 
     */ 
    public Certificate[] getPeerCertificates()
    throws SSLPeerUnverifiedException { 
        throw new SSLPeerUnverifiedException("test exception");
    } 
 
    /* 
     * @see javax.net.ssl.SSLSession#getPeerHost() 
     */ 
    public String getPeerHost() {
5
CodeRank
This code example shows how to use the following methods:
        // 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 {
        mSocket.setSoTimeout(timeoutMilliseconds);
    } 
 
    public boolean isOpen() { 
4
CodeRank
This code example shows how to use the following methods:
            "Long message for Exception. Long message for Exception. Long message for Exception." }; 
 
    @Override 
    protected Object[] getData() { 
        return new Object[] { new SSLPeerUnverifiedException(null), 
                new SSLPeerUnverifiedException(msgs[0]), new SSLPeerUnverifiedException(msgs[1]) }; 
    } 
 
    public static void main(String[] args) { 
        junit.textui.TestRunner.run(SSLPeerUnverifiedExceptionTest.class); 
    } 
} 
4
CodeRank
This code example shows how to use the following methods:
            "Long message for Exception. Long message for Exception. Long message for Exception." }; 
 
    @Override 
    protected Object[] getData() { 
        return new Object[] { new SSLPeerUnverifiedException(null), 
                new SSLPeerUnverifiedException(msgs[0]), new SSLPeerUnverifiedException(msgs[1]) }; 
    } 
 
} 
4
CodeRank
This code example shows how to use the following methods:
        // 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. 
     */ 
    @Override 
    public void setSoTimeout(int timeoutMilliseconds) throws SocketException {
        mSocket.setSoTimeout(timeoutMilliseconds);
    } 
 
4
CodeRank
This code example shows how to use the following methods:
        // 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. 
     */ 
    @Override 
    public void setSoTimeout(int timeoutMilliseconds) throws SocketException {
        mSocket.setSoTimeout(timeoutMilliseconds);
    } 
 
3
CodeRank

Related Java 8 SSLPeerUnverifiedException Questions & Answers:

See Code Examples for Java 8 SSLPeerUnverifiedException Methods: