@Test
    public void testSessionCredentials_Expired() throws Exception {
        mockServer.setResponseContent(expiredResponse());
        mockServer.setAvailableSecurityCredentials("test-credentials");

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

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