@Test
public void testSelfSignedCertificate() throws Exception {

    KeyStore keystore = createKeyStore();
    KeyStoreUtil.updateWithSelfSignedServerCertificate(keystore);
    X509Certificate cert = (X509Certificate) keystore.getCertificate("jolokia-agent");
    assertNotNull(cert);
    assertEquals(cert.getSubjectDN().getName(), "CN=Jolokia Agent " + Version.getAgentVersion() + ", OU=JVM, O=jolokia.org, L=Pegnitz, ST=Franconia, C=DE");
    assertEquals(cert.getSubjectDN(), cert.getIssuerDN());
}