Code example for SSLPeerUnverifiedException

0
     *         peer does not exist. 
     * 
     */ 
    public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
        if (peerCertificates == null) {
            throw new SSLPeerUnverifiedException("No peer certificate");
        } 
        return peerCertificates[0].getSubjectX500Principal();
    } 
 
    /** 
     * Returns via OpenSSL call the actual peer host name. 
     */ 
    private native String nativegetpeerhost();
 
    /** 
     * The peer's host name used in this SSL session is returned. It is the host 
     * name of the client for the server; and that of the server for the client. 
     * It is not a reliable way to get a fully qualified host name: it is mainly 
     * used internally to implement links for a temporary cache of SSL sessions. 
     *