@Test public void cacheHeadersFromCache() throws Exception {

    MockHttpStack mockHttpStack = new MockHttpStack();
    final NetworkResponse fakeResponse = new NetworkResponse(304, new byte[0],
            new Headers.Builder().add("responseheader", "response-foo").build(), 0);
    mockHttpStack.setResponseToReturn(fakeResponse);
    HttpNetwork httpNetwork = new HttpNetwork(mockHttpStack);
    Request<NetworkResponse> request = new Request<NetworkResponse>(Request.Method.GET, "http://foo") {
        @Override
        protected void deliverResponse(NetworkResponse response) {
        }
        @Override
        public Cache.Entry getCacheEntry() {
            Cache.Entry entry = new Cache.Entry();
            entry.data = "cached-foo".getBytes();
            entry.responseHeaders = new Headers.Builder()
                    .add("Date: Sun, 15 May 2016 11:03:26 GMT")
                    .add("ETag: W/\"123456\"")
                    .add("Cache-Control: public, max-age=60, s-maxage=60")
                    .add("Expires: Mon, 14 Nov 2016 11:03:26 GMT")
                    .add("Vary: Accept")
                    .add("Content-Location: /cache")
                    .build();
            return entry;
        }
    };
    request.setNetworkRequest(new NetworkRequest.Builder()
            .setHeader("requestheader", "foo").build());
    NetworkResponse networkResponse =  httpNetwork.performRequest(request);
    assertEquals("foo", mockHttpStack.getLastHeaders().get("requestheader"));
    assertEquals("cached-foo", new String(networkResponse.data));
    assertEquals("response-foo", networkResponse.headers.get("responseheader"));
    assertEquals("Sun, 15 May 2016 11:03:26 GMT", networkResponse.headers.get("Date"));
    assertEquals("W/\"123456\"", networkResponse.headers.get("ETag"));
    assertEquals("public, max-age=60, s-maxage=60", networkResponse.headers.get("Cache-Control"));
    assertEquals("Mon, 14 Nov 2016 11:03:26 GMT", networkResponse.headers.get("Expires"));
    assertEquals("Accept", networkResponse.headers.get("Vary"));
    assertEquals("/cache", networkResponse.headers.get("Content-Location"));
}