@Test
public void testCreateSSLContext() {

    System.setProperty(ZMSClient.ZMS_CLIENT_PROP_ATHENZ_CONF, "src/test/resources/athenz.conf");
    ZMSClient client = new ZMSClient();
    // no keystore path returns null
    SSLContext sslContext = client.createSSLContext();
    assertNull(sslContext);
    // set our properties
    System.setProperty(ZMSClient.ZMS_CLIENT_PROP_KEYSTORE_PATH, "src/test/resources/client.pkcs12");
    System.setProperty(ZMSClient.ZMS_CLIENT_PROP_KEYSTORE_TYPE, "pkcs12");
    System.setProperty(ZMSClient.ZMS_CLIENT_PROP_KEYSTORE_PASSWORD, "changeit");
    System.setProperty(ZMSClient.ZMS_CLIENT_PROP_KEY_MANAGER_PASSWORD, "test");
    System.setProperty(ZMSClient.ZMS_CLIENT_PROP_TRUSTSTORE_PATH, "src/test/resources/ca.pkcs12");
    System.setProperty(ZMSClient.ZMS_CLIENT_PROP_TRUSTSTORE_TYPE, "pkcs12");
    System.setProperty(ZMSClient.ZMS_CLIENT_PROP_TRUSTSTORE_PASSWORD, "changeit");
    sslContext = client.createSSLContext();
    assertNotNull(sslContext);
    // no passwords
    System.clearProperty(ZMSClient.ZMS_CLIENT_PROP_KEYSTORE_TYPE);
    System.clearProperty(ZMSClient.ZMS_CLIENT_PROP_TRUSTSTORE_TYPE);
    System.clearProperty(ZMSClient.ZMS_CLIENT_PROP_KEYSTORE_PASSWORD);
    System.clearProperty(ZMSClient.ZMS_CLIENT_PROP_TRUSTSTORE_PASSWORD);
    System.clearProperty(ZMSClient.ZMS_CLIENT_PROP_KEY_MANAGER_PASSWORD);
    try {
        client.createSSLContext();
        fail();
    } catch (Exception ignored) {
    }
    client.close();
    // reset all properties
    System.clearProperty(ZMSClient.ZMS_CLIENT_PROP_KEYSTORE_PATH);
    System.clearProperty(ZMSClient.ZMS_CLIENT_PROP_KEYSTORE_TYPE);
    System.clearProperty(ZMSClient.ZMS_CLIENT_PROP_KEYSTORE_PASSWORD);
    System.clearProperty(ZMSClient.ZMS_CLIENT_PROP_KEY_MANAGER_PASSWORD);
    System.clearProperty(ZMSClient.ZMS_CLIENT_PROP_TRUSTSTORE_PATH);
    System.clearProperty(ZMSClient.ZMS_CLIENT_PROP_TRUSTSTORE_TYPE);
    System.clearProperty(ZMSClient.ZMS_CLIENT_PROP_TRUSTSTORE_PASSWORD);
    System.clearProperty(ZMSClient.ZMS_CLIENT_PROP_ATHENZ_CONF);
}