String basepath = file.getParentFile().getAbsolutePath();
IServer server = new HttpServer(new FileServiceRequestHandler(basepath));
server.start();
HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
IHttpResponse response = con.call(new GetRequest("/" + file.getName()));
Assert.assertEquals(200, response.getStatus());
response.getBody().readString();
String lastModified = response.getHeader("Last-Modified");
GetRequest secondRequest = new GetRequest("/" + file.getName());
secondRequest.setHeader("If-Modified-Since", lastModified);
response = con.call(secondRequest);
Assert.assertEquals("unexpected response " + response, 304, response.getStatus());
file.delete();
con.close();
server.close();
}