ThumbprintTrustManager implements X509TrustManager { public synchronized void add(String thumbprint, Object owner) { String tp = thumbprint.toLowerCase(); ThumbprintHolder holder = thumbprints.get(tp); if (holder == null) { holder = new ThumbprintHolder(owner); thumbprints.put(tp, holder); } else { holder.addOwner(owner); } } ThumbprintTrustManager(); synchronized void add(String thumbprint, Object owner); void add(String thumbprint); synchronized void remove(String thumbprint, Object owner); void remove(String thumbprint); synchronized boolean hasThumbprint(String thumbprint); @Override void checkClientTrusted(X509Certificate[] chain, String authType); static String toHex(byte[] bytes, String separator); static String toHex(byte[] bytes); String certificateToThumbprint(Certificate cert); @Override void checkServerTrusted(X509Certificate[] chain, String authType); @Override X509Certificate[] getAcceptedIssuers();  }
@Test(groups = { "TestThumbprintTrustManager" }) public void testAdd() throws Exception { assertFalse(tt.hasThumbprint(thumbprint)); tt.add(thumbprint); assertTrue(tt.hasThumbprint(thumbprint)); }