You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2011/10/06 15:09:22 UTC
svn commit: r1179611 -
/httpcomponents/httpclient/branches/4.1.x/httpclient/src/test/java/org/apache/http/impl/conn/TestTSCCMWithServer.java
Author: olegk
Date: Thu Oct 6 13:09:22 2011
New Revision: 1179611
URL: http://svn.apache.org/viewvc?rev=1179611&view=rev
Log:
Removed obsolete test case
Modified:
httpcomponents/httpclient/branches/4.1.x/httpclient/src/test/java/org/apache/http/impl/conn/TestTSCCMWithServer.java
Modified: httpcomponents/httpclient/branches/4.1.x/httpclient/src/test/java/org/apache/http/impl/conn/TestTSCCMWithServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.1.x/httpclient/src/test/java/org/apache/http/impl/conn/TestTSCCMWithServer.java?rev=1179611&r1=1179610&r2=1179611&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.1.x/httpclient/src/test/java/org/apache/http/impl/conn/TestTSCCMWithServer.java (original)
+++ httpcomponents/httpclient/branches/4.1.x/httpclient/src/test/java/org/apache/http/impl/conn/TestTSCCMWithServer.java Thu Oct 6 13:09:22 2011
@@ -28,7 +28,6 @@
package org.apache.http.impl.conn;
import java.io.IOException;
-import java.lang.ref.WeakReference;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
@@ -484,56 +483,6 @@ public class TestTSCCMWithServer extends
mgr.shutdown();
}
- /**
- * Tests GC of an unreferenced connection manager.
- */
- @Test
- public void testConnectionManagerGC() throws Exception {
- // 3.x: TestHttpConnectionManager.testDroppedThread
-
- ThreadSafeClientConnManager mgr = createTSCCM(null);
-
- final HttpHost target = getServerHttp();
- final HttpRoute route = new HttpRoute(target, null, false);
- final int rsplen = 8;
- final String uri = "/random/" + rsplen;
-
- HttpRequest request =
- new BasicHttpRequest("GET", uri, HttpVersion.HTTP_1_1);
-
- ManagedClientConnection conn = getConnection(mgr, route);
- conn.open(route, httpContext, defaultParams);
-
- // a new context is created for each testcase, no need to reset
- HttpResponse response = Helper.execute(request, conn, target,
- httpExecutor, httpProcessor, defaultParams, httpContext);
- EntityUtils.toByteArray(response.getEntity());
-
- // release connection after marking it for re-use
- conn.markReusable();
- mgr.releaseConnection(conn, -1, null);
-
- // We now have a manager with an open connection in its pool.
- // We drop all potential hard reference to the manager and check
- // whether it is GCed. Internal references might prevent that
- // if set up incorrectly.
- // Note that we still keep references to the connection wrapper
- // we got from the manager, directly as well as in the request
- // and in the context. The manager will be GCed only if the
- // connection wrapper is truly detached.
- WeakReference<ThreadSafeClientConnManager> wref =
- new WeakReference<ThreadSafeClientConnManager>(mgr);
- mgr = null;
-
- // Java does not guarantee that this will trigger the GC, but
- // it does in the test environment. GC is asynchronous, so we
- // need to give the garbage collector some time afterwards.
- System.gc();
- Thread.sleep(1000);
-
- Assert.assertNull("TSCCM not garbage collected", wref.get());
- }
-
@Test
public void testAbortDuringConnecting() throws Exception {
final CountDownLatch connectLatch = new CountDownLatch(1);