@Override
    public void checkServerTrusted(final X509Certificate[] certs, final String cipher) throws CertificateException {
        if((certs != null)) {
            if(log.isDebugEnabled()) {
                log.debug("Server certificate chain:");
                for(int i = 0; i < certs.length; i++) {
                    log.debug(String.format("X509Certificate[%d]=%s", i, certs[i]));
                }
            }
        }
        if((certs != null) && (certs.length == 1)) {
            this.verify(null, certs, cipher);
        }
        else {
            system.checkServerTrusted(certs, cipher);
        }
    }
@Test(expected = CertificateExpiredException.class)
    public void testCheckServerTrusted() throws Exception {
        final DefaultX509TrustManager m = new DefaultX509TrustManager();
        InputStream inStream = new FileInputStream("src/test/resources/OXxlRDVcWqdPEvFm.cer");
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        X509Certificate cert = (X509Certificate) cf.generateCertificate(inStream);
        m.checkServerTrusted(new X509Certificate[]{cert}, "RSA");
    }