Home | History | Annotate | Download | only in okhttp

Lines Matching refs:pool

48     ConnectionPool pool = new ConnectionPool(Integer.MAX_VALUE, 100L, TimeUnit.NANOSECONDS);
49 pool.setCleanupRunnableForTest(emptyRunnable);
51 RealConnection c1 = newConnection(pool, routeA1, 50L);
53 // Running at time 50, the pool returns that nothing can be evicted until time 150.
54 assertEquals(100L, pool.cleanup(50L));
55 assertEquals(1, pool.getConnectionCount());
58 // Running at time 60, the pool returns that nothing can be evicted until time 150.
59 assertEquals(90L, pool.cleanup(60L));
60 assertEquals(1, pool.getConnectionCount());
63 // Running at time 149, the pool returns that nothing can be evicted until time 150.
64 assertEquals(1L, pool.cleanup(149L));
65 assertEquals(1, pool.getConnectionCount());
68 // Running at time 150, the pool evicts.
69 assertEquals(0, pool.cleanup(150L));
70 assertEquals(0, pool.getConnectionCount());
73 // Running again, the pool reports that no further runs are necessary.
74 assertEquals(-1, pool.cleanup(150L));
75 assertEquals(0, pool.getConnectionCount());
80 ConnectionPool pool = new ConnectionPool(Integer.MAX_VALUE, 100L, TimeUnit.NANOSECONDS);
81 pool.setCleanupRunnableForTest(emptyRunnable);
83 RealConnection c1 = newConnection(pool, routeA1, 50L);
84 StreamAllocation streamAllocation = new StreamAllocation(pool, addressA);
87 // Running at time 50, the pool returns that nothing can be evicted until time 150.
88 assertEquals(100L, pool.cleanup(50L));
89 assertEquals(1, pool.getConnectionCount());
92 // Running at time 60, the pool returns that nothing can be evicted until time 160.
93 assertEquals(100L, pool.cleanup(60L));
94 assertEquals(1, pool.getConnectionCount());
97 // Running at time 160, the pool returns that nothing can be evicted until time 260.
98 assertEquals(100L, pool.cleanup(160L));
99 assertEquals(1, pool.getConnectionCount());
104 ConnectionPool pool = new ConnectionPool(Integer.MAX_VALUE, 100L, TimeUnit.NANOSECONDS);
105 pool.setCleanupRunnableForTest(emptyRunnable);
107 RealConnection c1 = newConnection(pool, routeA1, 75L);
108 RealConnection c2 = newConnection(pool, routeB1, 50L);
110 // Running at time 75, the pool returns that nothing can be evicted until time 150.
111 assertEquals(75L, pool.cleanup(75L));
112 assertEquals(2, pool.getConnectionCount());
114 // Running at time 149, the pool returns that nothing can be evicted until time 150.
115 assertEquals(1L, pool.cleanup(149L));
116 assertEquals(2, pool.getConnectionCount());
118 // Running at time 150, the pool evicts c2.
119 assertEquals(0L, pool.cleanup(150L));
120 assertEquals(1, pool.getConnectionCount());
124 // Running at time 150, the pool returns that nothing can be evicted until time 175.
125 assertEquals(25L, pool.cleanup(150L));
126 assertEquals(1, pool.getConnectionCount());
128 // Running at time 175, the pool evicts c1.
129 assertEquals(0L, pool.cleanup(175L));
130 assertEquals(0, pool.getConnectionCount());
136 ConnectionPool pool = new ConnectionPool(2, 100L, TimeUnit.NANOSECONDS);
137 pool.setCleanupRunnableForTest(emptyRunnable);
139 RealConnection c1 = newConnection(pool, routeA1, 50L);
140 RealConnection c2 = newConnection(pool, routeB1, 75L);
143 assertEquals(50L, pool.cleanup(100L));
144 assertEquals(2, pool.getConnectionCount());
149 RealConnection c3 = newConnection(pool, routeC1, 75L);
152 assertEquals(0L, pool.cleanup(100L));
153 assertEquals(2, pool.getConnectionCount());
160 ConnectionPool pool = new ConnectionPool(2, 100L, TimeUnit.NANOSECONDS);
161 pool.setCleanupRunnableForTest(emptyRunnable);
163 RealConnection c1 = newConnection(pool, routeA1, 0L);
164 allocateAndLeakAllocation(pool, c1);
167 assertEquals(0L, pool.cleanup(100L));
174 private void allocateAndLeakAllocation(ConnectionPool pool, RealConnection connection) {
175 StreamAllocation leak = new StreamAllocation(pool, connection.getRoute().getAddress());
190 private RealConnection newConnection(ConnectionPool pool, Route route, long idleAtNanos) {
194 synchronized (pool) {
195 pool.put(connection);