public void testDroppedThread() throws Exception {
MultiThreadedHttpConnectionManager mthcm = new MultiThreadedHttpConnectionManager();
HttpClient httpClient = createHttpClient(mthcm);
WeakReference wr = new WeakReference(mthcm);
GetMethod method = new GetMethod("/");
httpClient.executeMethod(method);
method.releaseConnection();
mthcm = null;
httpClient = null;
method = null;
System.gc();
// this sleep appears to be necessary in order to give the JVM
// time to clean up the miscellaneous pointers to the connection manager
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
fail("shouldn't be interrupted.");
}
Object connectionManager = wr.get();
assertNull("connectionManager should be null", connectionManager);
}