JaasCertificateValidationCallbackHandler extends AbstractJaasValidationCallbackHandler { @Override protected final void handleInternal(Callback callback) throws UnsupportedCallbackException { if (callback instanceof CertificateValidationCallback) { ((CertificateValidationCallback) callback).setValidator(new JaasCertificateValidator()); } else { throw new UnsupportedCallbackException(callback); } }    }
@Test public void testValidateCertificateValid() throws Exception { callbackHandler.handleInternal(callback); boolean authenticated = callback.getResult(); Assert.assertTrue("Not authenticated", authenticated); }