@Test
public void testAccessTokenSignedTokenServerKeysFailure() {

    long now = System.currentTimeMillis() / 1000;
    AccessToken accessToken = createAccessToken(now);
    // now get the signed token
    PrivateKey privateKey = Crypto.loadPrivateKey(ecPrivateKey);
    String accessJws = accessToken.getSignedToken(privateKey, "eckey1", SignatureAlgorithm.ES256);
    assertNotNull(accessJws);
    // now verify our signed token
    final String oldConf = System.setProperty(JwtsSigningKeyResolver.ZTS_PROP_ATHENZ_CONF,
            "src/test/resources/athenz-no-keys.conf");
    MockJwtsSigningKeyResolver.setResponseCode(401);
    MockJwtsSigningKeyResolver.setResponseBody("");
    SSLContext sslContext = Mockito.mock(SSLContext.class);
    MockJwtsSigningKeyResolver resolver = new MockJwtsSigningKeyResolver("https://localhost:4443", sslContext);
    try {
        new AccessToken(accessJws, resolver);
        fail();
    } catch (Exception ex) {
        assertTrue(ex instanceof IllegalArgumentException, ex.getMessage());
    }
    if (oldConf == null) {
        System.clearProperty(JwtsSigningKeyResolver.ZTS_PROP_ATHENZ_CONF);
    } else {
        System.setProperty(JwtsSigningKeyResolver.ZTS_PROP_ATHENZ_CONF, oldConf);
    }
}