Code example for SSLSession

Methods: getPeerCertificatesgetPeerHost

0
	} 
 
	public static void showCerts(SSLSession session) {
		X509Certificate cert = null;
		try { 
			cert = (X509Certificate) session.getPeerCertificates()[0];
		} catch (SSLPeerUnverifiedException e) {
			e.printStackTrace();
			System.err.println(session.getPeerHost()
					+ " did not present a valid certificate"); 
 
			return; 
		} 
		System.out.println(session.getPeerHost()
				+ " has presented a certificate belonging to" + "[" 
				+ cert.getSubjectDN() + "]\n"
				+ "The certificate was issued by: \t" + "[" 
				+ cert.getIssuerDN() + "]");
 
	} 
Connect your IDE to all the code out there  Get Codota for Java