@Test
public void testInitializeAwsSupport()  throws ExecutionException, TimeoutException {

    CloudStore store = new CloudStore();
    HttpClient httpClient = Mockito.mock(HttpClient.class);
    ContentResponse responseDoc = Mockito.mock(ContentResponse.class);
    Mockito.when(responseDoc.getStatus()).thenReturn(200);
    Mockito.when(responseDoc.getContentAsString()).thenReturn(AWS_INSTANCE_DOCUMENT);
    ContentResponse responseSig = Mockito.mock(ContentResponse.class);
    Mockito.when(responseSig.getStatus()).thenReturn(200);
    Mockito.when(responseSig.getContentAsString()).thenReturn("pkcs7-signature");
    ContentResponse responseInfo = Mockito.mock(ContentResponse.class);
    Mockito.when(responseInfo.getStatus()).thenReturn(200);
    Mockito.when(responseInfo.getContentAsString()).thenReturn(AWS_IAM_ROLE_INFO);
    ContentResponse responseCreds = Mockito.mock(ContentResponse.class);
    Mockito.when(responseCreds.getStatus()).thenReturn(200);
    Mockito.when(responseCreds.getContentAsString()).thenReturn("{\"AccessKeyId\":\"id\",\"SecretAccessKey\":\"key\",\"Token\":\"token\"}");
    store.setHttpClient(httpClient);
    try {
        Mockito.when(httpClient.GET("http://169.254.169.254/latest/dynamic/instance-identity/document")).thenReturn(responseDoc);
    } catch (InterruptedException ignored) {
    }
    try {
        Mockito.when(httpClient.GET("http://169.254.169.254/latest/dynamic/instance-identity/pkcs7")).thenReturn(responseSig);
    } catch (InterruptedException ignored) {
    }
    try {
        Mockito.when(httpClient.GET("http://169.254.169.254/latest/meta-data/iam/info")).thenReturn(responseInfo);
    } catch (InterruptedException ignored) {
    }
    try {
        Mockito.when(httpClient.GET("http://169.254.169.254/latest/meta-data/iam/security-credentials/athenz.zts")).thenReturn(responseCreds);
    } catch (InterruptedException ignored) {
    }
    // set creds update time every second
    System.setProperty(ZTSConsts.ZTS_PROP_AWS_CREDS_UPDATE_TIMEOUT, "1");
    store.awsEnabled = true;
    store.initializeAwsSupport();
    // sleep a couple of seconds for the background thread to run
    // before we try to shutting it down
    try {
        Thread.sleep(2000);
    } catch (InterruptedException ignored) {
    }
    store.close();
    System.clearProperty(ZTSConsts.ZTS_PROP_AWS_CREDS_UPDATE_TIMEOUT);
}