resp.setHeader("Cache-Control", "public, max-age=1000, must-revalidate");
exchange.send(resp);
}
};
HttpServer server = new HttpServer(reqHdl);
server.start();
HttpClient httpClient = new HttpClient();
httpClient.setCacheMaxSizeKB(100);
IHttpResponse resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
Assert.assertEquals(200, resp.getStatus());
Assert.assertEquals("test", resp.getBody().readString());
Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
QAUtil.sleep(1000);
resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
Assert.assertEquals(200, resp.getStatus());
Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
Assert.assertEquals("test", resp.getBody().readString());
Assert.assertEquals(0, httpClient.getNumCacheHit());
Assert.assertEquals(2, httpClient.getNumCacheMiss());
httpClient.close();
server.close();
}