ClassLoader loader = Thread.currentThread().getContextClassLoader();
URL resURL = loader.getResource("security/tst.keystore");
store.load(resURL.openStream(), "unit-tests".toCharArray());
X509Certificate cert = (X509Certificate) store.getCertificate("unit-tests");
SimplePrincipal x509 = new SimplePrincipal("unit-tests");
SecurityAssociationHandler handler = new SecurityAssociationHandler(x509, cert);
LoginContext lc = new LoginContext("testCertLogin", handler);
lc.login();
Subject subject = lc.getSubject();
assertTrue("Principals contains unit-tests", subject.getPrincipals().contains(new SimplePrincipal("unit-tests")));
assertTrue("Principals contains x509cert",