final HttpRequestWrapper req1 = HttpRequestWrapper.wrap(
new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
req1.setHeader("Range","bytes=0-49");
final HttpResponse resp1 = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_PARTIAL_CONTENT, "Partial Content");
resp1.setEntity(HttpTestUtils.makeBody(50));
resp1.setHeader("Cache-Control","max-age=3600");
resp1.setHeader("Content-Range","bytes 0-49/128");
resp1.setHeader("Etag","\"etag1\"");
resp1.setHeader("Server","MockServer/1.0");
resp1.setHeader("Date", DateUtils.formatDate(oneSecondAgo));
backendExpectsAnyRequestAndReturn(resp1);
final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(
new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
req2.setHeader("Range","bytes=50-127");
final HttpResponse resp2 = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_PARTIAL_CONTENT, "Partial Content");
resp2.setEntity(HttpTestUtils.makeBody(78));
resp2.setHeader("Cache-Control","max-age=3600");
resp2.setHeader("Content-Range","bytes 50-127/128");
resp2.setHeader("ETag","\"etag2\"");
resp2.setHeader("Server","MockServer/1.0");
resp2.setHeader("Date", DateUtils.formatDate(twoSecondsAgo));
backendExpectsAnyRequestAndReturn(resp2);
final HttpRequestWrapper req3 = HttpRequestWrapper.wrap(
new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
req3.setHeader("Range","bytes=50-127");
final HttpResponse resp3 = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
resp3.setEntity(HttpTestUtils.makeBody(128));
resp3.setHeader("Server","MockServer/1.0");
resp3.setHeader("Date", DateUtils.formatDate(now));
// must make this request; cannot serve from cache
backendExpectsAnyRequestAndReturn(resp3);
replayMocks();