### Question:
JwksManager { public void fetchJwks(@NonNull final KeycloakConfiguration keycloakConfiguration, @Nullable final Callback<JsonWebKeySet> cb) { String jwksUrl = nonNull(keycloakConfiguration, "keycloakConfiguration").getJwksUrl(); HttpRequest getRequest = httpModule.newRequest(); getRequest.get(jwksUrl).respondWith(new Responder<HttpResponse>() { @Override public void onResult(HttpResponse response) { JsonWebKeySet jwks = null; Callback callback = cb != null ? cb : NOOP_CALLBACK; try { if (response.getStatus() == 200) { String jwksContent = response.stringBody(); jwks = new JsonWebKeySet(jwksContent); persistJwksContent(keycloakConfiguration.getRealmName(), jwksContent); callback.onSuccess(jwks); } else { LOGGER.warning("failed to fetch JWKS from server. url = " + jwksUrl + " statusCode = " + response.getStatus()); throw new JwksException("failed to fetch JWKS from server"); } } catch (JoseException je) { LOGGER.warning("failed to parse JWKS key content. content = " + response.stringBody()); callback.onError(new JwksException(je)); } catch (Exception e) { callback.onError(e); } } @Override public void onException(Exception exception) { LOGGER.error(TAG, exception.getMessage(), exception); } }); } JwksManager(@NonNull final Context context, @NonNull final MobileCore mobileCore,
                    @NonNull final AuthServiceConfiguration authServiceConfiguration); JsonWebKeySet load(final KeycloakConfiguration keyCloakConfig); boolean fetchJwksIfNeeded(final KeycloakConfiguration keycloakConfiguration,
                    final boolean forceFetch); void fetchJwks(@NonNull final KeycloakConfiguration keycloakConfiguration,
                    @Nullable final Callback<JsonWebKeySet> cb); static final String TAG; }### Answer:
@Test public void testFetchJwks() throws InterruptedException { final CountDownLatch lock = new CountDownLatch(1); JwksManager jwksManager = new JwksManager(ctx, mobileCore, authServiceConfiguration); jwksManager.fetchJwks(keycloakConfiguration, new Callback<JsonWebKeySet>() { @Override public void onSuccess(JsonWebKeySet models) { keySet = models; lock.countDown(); } @Override public void onError(Throwable error) { exception = error; lock.countDown(); } }); lock.await(1000, TimeUnit.MILLISECONDS); Assert.assertNotNull(keySet); Assert.assertNull(exception); List<JsonWebKey> keys = keySet.getJsonWebKeys(); Assert.assertEquals(1, keys.size()); JsonWebKey key = keys.get(0); Assert.assertEquals(KEYALG, key.getAlgorithm()); Assert.assertEquals(KEYID, key.getKeyId()); }