@Test
    void testStaleIfErrorInResponseYieldsToProxyRevalidateForSharedCache() throws Exception {
        assertTrue(config.isSharedCache());
        final Instant tenSecondsAgo = Instant.now().minusSeconds(10);
        final ClassicHttpRequest req1 = HttpTestUtils.makeDefaultRequest();
        final ClassicHttpResponse resp1 = HttpTestUtils.make200Response(tenSecondsAgo,
                "public, max-age=5, stale-if-error=60, proxy-revalidate");

        final ClassicHttpRequest req2 = HttpTestUtils.makeDefaultRequest();
        final ClassicHttpResponse resp2 = HttpTestUtils.make500Response();

        Mockito.when(mockExecChain.proceed(Mockito.any(), Mockito.any())).thenReturn(resp1);

        execute(req1);

        Mockito.when(mockExecChain.proceed(Mockito.any(), Mockito.any())).thenReturn(resp2);

        final ClassicHttpResponse result = execute(req2);

        assertNotEquals(HttpStatus.SC_OK, result.getCode());
    }
A suite of acceptance tests for compliance with RFC5861, which
describes the stale-if-error and stale-while-revalidate
Cache-Control extensions.
httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestRFC5861Compliance.java