code: private X509Certificate getClientCert(HttpsExchange pHttpsExchange) {
          try {
              Certificate[] peerCerts = pHttpsExchange.getSSLSession().getPeerCertificates();
              return peerCerts != null && peerCerts.length > 0 ? (X509Certificate) peerCerts[0] : null;
          } catch (SSLPeerUnverifiedException e) {
              throw new SecurityException("SSL Peer couldn't be verified");
          }
  
      }
docs: =================================================================================