code: public Principal getPeerPrincipal()
              throws SSLPeerUnverifiedException {
  
          java.security.cert.Certificate[] certs = getServerCertificates();
          return ((X500Principal)
                  ((X509Certificate)certs[0]).getSubjectX500Principal());
      }
docs: Returns the server's principal which was established as part of
  defining the session.
  <P>
  Note: Subclasses should override this method. If not overridden, it
  will default to returning the X500Principal of the server's end-entity
  certificate for certificate-based ciphersuites, or throw an
  SSLPeerUnverifiedException for non-certificate based ciphersuites,
  such as Kerberos.
  
  @return the server'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 was not verified
  @throws IllegalStateException if this method is called before
  the connection has been established.
  
  @see #getServerCertificates()
  @see #getLocalPrincipal()
  
  @since 1.5