public void testRecycle() {
HttpClient client = new HttpClient();
client.getHostConfiguration().setHost(host, port, "http");
TraceMethod method = new TraceMethod("/");
try {
client.executeMethod(method);
} catch (Throwable t) {
t.printStackTrace();
fail("Unable to execute method : " + t.toString());
}
try {
String data = method.getResponseBodyAsString();
assertTrue("No data returned.",(data.length() > 0));
} catch (Throwable t) {
t.printStackTrace();
fail("Unable to execute method : " + t.toString());
}
method.recycle();
method.setPath("/");
try {
client.executeMethod(method);
} catch (Throwable t) {
t.printStackTrace();
fail("Unable to execute method : " + t.toString());
}
try {
String data = method.getResponseBodyAsString();
assertTrue("No data returned.",(data.length() > 0));
} catch (Throwable t) {
t.printStackTrace();
fail("Unable to execute method : " + t.toString());
}