@Test
public void testRewriteCookie() throws Exception {
HttpServer server = new HttpServer(new RequestHandler());
server.start();
HttpClient httpClient = new HttpClient();
GetRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
IHttpResponse response = httpClient.call(request);
Assert.assertEquals(200, response.getStatus());
request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
response = httpClient.call(request);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("JSESSIONID=1", request.getHeader("Cookie"));
request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
response = httpClient.call(request);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("JSESSIONID=2", request.getHeader("Cookie"));
request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
response = httpClient.call(request);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("JSESSIONID=3", request.getHeader("Cookie"));
httpClient.close();
server.close();
}