code: public synchronized X509Certificate getCertificateByHostname(final String hostname) throws KeyStoreException, CertificateParsingException, InvalidKeyException, CertificateExpiredException, CertificateNotYetValidException, SignatureException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException, UnrecoverableKeyException{
  
  		String alias = _subjectMap.get(getSubjectForHostname(hostname));
  
  		if(alias != null) {
  			return (X509Certificate)_ks.getCertificate(alias);
  		}
          return getMappedCertificateForHostname(hostname);
  	}
docs: Returns the aliased certificate.  Certificates are aliased by their hostname.
  @see ThumbprintUtil
  @param alias
  @return
  @throws KeyStoreException
  @throws UnrecoverableKeyException
  @throws NoSuchProviderException
  @throws NoSuchAlgorithmException
  @throws CertificateException
  @throws SignatureException
  @throws CertificateNotYetValidException
  @throws CertificateExpiredException
  @throws InvalidKeyException
  @throws CertificateParsingException