String result = client.post("redirect", "foo");
assertEquals(result, "fooPOSTREDIRECT");
assertEquals(server.getRequestCount(), 1);
assertEquals(redirectTarget.getRequestCount(), 1);
// Verify that the body was populated after the redirect
RecordedRequest request = server.takeRequest();
assertEquals(new String(request.getBody(), "UTF-8"), "foo");
request = redirectTarget.takeRequest();
assertEquals(new String(request.getBody(), "UTF-8"), "foo");
} finally {
close(client, true);
redirectTarget.shutdown();
server.shutdown();
}