Search in sources :

Example 1 with ConnPoolControl

use of org.apache.http.pool.ConnPoolControl in project maven-resolver by apache.

the class HttpTransporterTest method testConnectionReuse.

@Test
public void testConnectionReuse() throws Exception {
    httpServer.addSslConnector();
    session.setCache(new DefaultRepositoryCache());
    for (int i = 0; i < 3; i++) {
        newTransporter(httpServer.getHttpsUrl());
        GetTask task = new GetTask(URI.create("repo/file.txt"));
        transporter.get(task);
        assertEquals("test", task.getDataString());
    }
    PoolStats stats = ((ConnPoolControl<?>) ((HttpTransporter) transporter).getState().getConnectionManager()).getTotalStats();
    assertEquals(stats.toString(), 1, stats.getAvailable());
}
Also used : ConnPoolControl(org.apache.http.pool.ConnPoolControl) GetTask(org.eclipse.aether.spi.connector.transport.GetTask) DefaultRepositoryCache(org.eclipse.aether.DefaultRepositoryCache) PoolStats(org.apache.http.pool.PoolStats) Test(org.junit.Test)

Aggregations

ConnPoolControl (org.apache.http.pool.ConnPoolControl)1 PoolStats (org.apache.http.pool.PoolStats)1 DefaultRepositoryCache (org.eclipse.aether.DefaultRepositoryCache)1 GetTask (org.eclipse.aether.spi.connector.transport.GetTask)1 Test (org.junit.Test)1