### Question:
DefaultTokenManager implements TokenManager { protected synchronized void retrieveToken() { log.debug("OAuthTokenManager.retrieveToken"); if (token == null || (Long.valueOf(token.getExpiration()) < System.currentTimeMillis() / 1000L)) { log.debug("Token is null, retrieving initial token from provider"); boolean tokenRequest = true; int retryCount = 0; while (tokenRequest && retryCount < this.iamMaxRetry) { try { ++retryCount; token = provider.retrieveToken(); tokenRequest = false; } catch (OAuthServiceException exception) { log.debug("Exception retrieving IAM token. Returned status code " + exception.getStatusCode() + "Retry attempt " + retryCount); tokenRequest = shouldRetry(exception.getStatusCode()) ? true : false; if (!tokenRequest || retryCount == this.iamMaxRetry) { throw exception; } } } if(null == token) { throw new OAuthServiceException("Null token returned by the Token Provider"); } cacheToken(token); } } DefaultTokenManager(String apiKey);  DefaultTokenManager(TokenProvider provider); void setIamEndpoint(String iamEndpoint); void setIamRefreshOffset(double offset); void setIamMaxRetry(int count); TokenProvider getProvider(); @Override String getToken(); ClientConfiguration getClientConfiguration(); void setClientConfiguration(ClientConfiguration clientConfiguration); static void addProxyConfig(HttpClientBuilder builder,
			HttpClientSettings settings);  }### Answer:
@Test @Ignore public void shouldOnlyCallIAMOnceInMutliThreadForInitialToken() { TokenProvider tokenProviderMock = mock(TokenProvider.class); when(tokenProviderMock.retrieveToken()).thenReturn(token); defaultTokenManager = new DefaultTokenManager(tokenProviderMock); Thread t1 = new Thread(new ManagerThreadUtil(defaultTokenManager)); Thread t2 = new Thread(new ManagerThreadUtil(defaultTokenManager)); Thread t3 = new Thread(new ManagerThreadUtil(defaultTokenManager)); Thread t4 = new Thread(new ManagerThreadUtil(defaultTokenManager)); t1.start(); t2.start(); t3.start(); t4.start(); assertEquals(1, Mockito.mockingDetails(tokenProviderMock).getInvocations().size()); }