// Connect to server1 to create a session and get its session cookie
ContentExchange exchange1 = new ContentExchange(true);
exchange1.setMethod(HttpMethods.GET);
exchange1.setURL("http://localhost:" + port1 + contextPath + servletMapping + "?action=init");
client.send(exchange1);
exchange1.waitForDone();
assert exchange1.getResponseStatus() == HttpServletResponse.SC_OK;
String sessionCookie = exchange1.getResponseFields().getStringField("Set-Cookie");
assert sessionCookie != null;
// Mangle the cookie, replacing Path with $Path, etc.
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");