code: public Principal getPeerPrincipal()
              throws SSLPeerUnverifiedException
      {
          Principal principal;
          try {
              principal = session.getPeerPrincipal();
          } catch (AbstractMethodError e) {
              // if the provider does not support it, fallback to peer certs.
              // return the X500Principal of the end-entity cert.
              Certificate[] certs = getPeerCertificates();
              principal = ((X509Certificate)certs[0]).getSubjectX500Principal();
          }
          return principal;
      }
docs: Returns the identity of the peer which was established as part of
  defining the session.
  
  @return the peer's principal. Returns an X500Principal of the
  end-entity certiticate for X509-based cipher suites, and
  KerberosPrincipal for Kerberos cipher suites.
  
  @throws SSLPeerUnverifiedException if the peer's identity has not
  been verified
  
  @see #getPeerCertificates()
  @see #getLocalPrincipal()
  
  @since 1.5