File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
src/test/java/com/ning/http/client/async Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 4040import com .ning .http .client .AsyncHttpClient ;
4141import com .ning .http .client .AsyncHttpClientConfig ;
4242import com .ning .http .client .ListenableFuture ;
43+ import com .ning .http .client .Request ;
44+ import com .ning .http .client .RequestBuilder ;
4345import com .ning .http .client .Response ;
4446
4547public abstract class ConnectionPoolTest extends AbstractBasicTest {
@@ -246,4 +248,25 @@ public Response onCompleted(Response response) throws Exception {
246248 assertEquals (count .get (), 0 );
247249 }
248250 }
251+
252+ @ Test (groups = { "standalone" , "default_provider" })
253+ public void nonPoolableConnectionReleaseSemaphoresTest () throws Throwable {
254+
255+ AsyncHttpClientConfig config = new AsyncHttpClientConfig .Builder ()
256+ .setMaxConnections (6 )
257+ .setMaxConnectionsPerHost (3 )
258+ .build ();
259+
260+ Request request = new RequestBuilder ().setUrl (getTargetUrl ()).setHeader ("Connection" , "close" ).build ();
261+
262+ try (AsyncHttpClient client = getAsyncHttpClient (config )) {
263+ client .executeRequest (request ).get ();
264+ Thread .sleep (1000 );
265+ client .executeRequest (request ).get ();
266+ Thread .sleep (1000 );
267+ client .executeRequest (request ).get ();
268+ Thread .sleep (1000 );
269+ client .executeRequest (request ).get ();
270+ }
271+ }
249272}
You can’t perform that action at this time.
0 commit comments