@Test
    public void testSessionCredentials() throws Exception {
        mockServer.setResponseContent(nonExpiredResponse());
        mockServer.setAvailableSecurityCredentials("aws-dr-tools-test");

        InstanceProfileCredentialsProvider credentialsProvider = new InstanceProfileCredentialsProvider();
        AWSSessionCredentials credentials = (AWSSessionCredentials) credentialsProvider.getCredentials();

        assertEquals("ACCESS_KEY_ID",     credentials.getAWSAccessKeyId());
        assertEquals("SECRET_ACCESS_KEY", credentials.getAWSSecretKey());
        assertEquals("TOKEN_TOKEN_TOKEN", credentials.getSessionToken());
    }
Tests that we correctly handle the metadata service returning credentials.
aws-java-sdk-core/src/test/java/com/amazonaws/auth/InstanceProfileCredentialsProviderIntegrationTest.java