- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 16 for connectionCount (0.07 seconds)
-
okhttp/src/jvmTest/kotlin/okhttp3/SocksProxy.kt
} } } fun proxy(): Proxy = Proxy( Proxy.Type.SOCKS, InetSocketAddress.createUnresolved("localhost", serverSocket!!.localPort), ) fun connectionCount(): Int = connectionCount.get() fun shutdown() { serverSocket!!.close() executor.shutdown() if (!executor.awaitTermination(5, TimeUnit.SECONDS)) { throw IOException("Gave up waiting for executor to shut down")Created: 2026-04-03 11:42 - Last Modified: 2026-01-27 09:00 - 7.7K bytes - Click Count (0) -
okhttp/src/commonJvmAndroid/kotlin/okhttp3/ConnectionPool.kt
/** Returns the number of idle connections in the pool. */ fun idleConnectionCount(): Int = delegate.idleConnectionCount() /** Returns total number of connections in the pool. */ fun connectionCount(): Int = delegate.connectionCount() internal val connectionListener: ConnectionListener get() = delegate.connectionListener /** Close and remove all idle connections in the pool. */ fun evictAll() {
Created: 2026-04-03 11:42 - Last Modified: 2025-10-07 21:55 - 3.4K bytes - Click Count (0) -
okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/connection/RealConnectionPool.kt
require(keepAliveDuration > 0L) { "keepAliveDuration <= 0: $keepAliveDuration" } } fun idleConnectionCount(): Int = connections.count { it.withLock { it.calls.isEmpty() } } fun connectionCount(): Int = connections.size /** * Attempts to acquire a recycled connection to [address] for [call]. Returns the connection if it
Created: 2026-04-03 11:42 - Last Modified: 2026-01-27 09:00 - 11.1K bytes - Click Count (0) -
okhttp/src/jvmTest/kotlin/okhttp3/ConnectionCoalescingTest.kt
assert200Http2Response(execute(url), server.hostName) val sanUrl = url.newBuilder().host("san.com").build() assert200Http2Response(execute(sanUrl), "san.com") assertThat(client.connectionPool.connectionCount()).isEqualTo(1) } /** * Test connecting to an alternative host then common name, although only subject alternative * names are used if present no special consideration of common name. */
Created: 2026-04-03 11:42 - Last Modified: 2025-06-19 11:44 - 19.1K bytes - Click Count (0) -
okhttp/src/jvmTest/kotlin/okhttp3/internal/connection/ConnectionPoolTest.kt
assertThat(pool.closeConnections(50L)).isEqualTo(100L) assertThat(pool.connectionCount()).isEqualTo(1) assertThat(c1.socket().isClosed).isFalse() // Running at time 60, the pool returns that nothing can be evicted until time 150. assertThat(pool.closeConnections(60L)).isEqualTo(90L) assertThat(pool.connectionCount()).isEqualTo(1) assertThat(c1.socket().isClosed).isFalse()
Created: 2026-04-03 11:42 - Last Modified: 2025-10-07 21:55 - 8.2K bytes - Click Count (0) -
okhttp/src/jvmTest/kotlin/okhttp3/KotlinSourceModernTest.kt
var connectionPool = ConnectionPool() connectionPool = ConnectionPool(0, 0L, TimeUnit.SECONDS) val idleConnectionCount: Int = connectionPool.idleConnectionCount() val connectionCount: Int = connectionPool.connectionCount() connectionPool.evictAll() } @Test fun connectionSpec() { var connectionSpec: ConnectionSpec = ConnectionSpec.RESTRICTED_TLS connectionSpec = ConnectionSpec.MODERN_TLS
Created: 2026-04-03 11:42 - Last Modified: 2026-03-10 21:47 - 49.7K bytes - Click Count (0) -
okhttp/src/jvmTest/kotlin/okhttp3/SocksProxyTest.kt
val response2 = client.newCall(request2).execute() assertThat(response2.body.string()).isEqualTo("def") // The HTTP calls should share a single connection. assertThat(socksProxy.connectionCount()).isEqualTo(1) } @Test fun proxySelector() { server.enqueue(MockResponse.Builder().body("abc").build()) val proxySelector: ProxySelector = object : ProxySelector() {
Created: 2026-04-03 11:42 - Last Modified: 2025-06-18 12:28 - 3.6K bytes - Click Count (0) -
okhttp-testing-support/src/main/kotlin/okhttp3/OkHttpClientTestRule.kt
connectionPool.evictAll() if (connectionPool.connectionCount() > 0) { // Minimise test flakiness due to possible race conditions with connections closing. // Some number of tests will report here, but not fail due to this delay. println("Delaying to avoid flakes") Thread.sleep(500L) println("After delay: " + connectionPool.connectionCount()) } connectionPool.evictAll()Created: 2026-04-03 11:42 - Last Modified: 2025-11-04 19:13 - 10.8K bytes - Click Count (0) -
android-test/src/androidDeviceTest/java/okhttp/android/test/SingleAndroidTest.kt
val response = client.newCall(request).execute() response.use { assertEquals(200, response.code) } while (client.connectionPool.connectionCount() > 0) { Thread.sleep(1000) } } @Test fun testHttpRequest() { server.enqueue(MockResponse()) server.start() val request = Request.Builder().url(server.url("/")).build()Created: 2026-04-03 11:42 - Last Modified: 2026-01-26 07:38 - 2.1K bytes - Click Count (0) -
okhttp/src/jvmTest/kotlin/okhttp3/SessionReuseTest.kt
client.newCall(request).execute().use { response -> assertEquals(200, response.code) } client.connectionPool.evictAll() assertEquals(0, client.connectionPool.connectionCount()) // Force reuse. This appears flaky (30% of the time) even though sessions are reused. // javax.net.ssl.SSLHandshakeException: No new session is allowed and no existing // session can be resumed //Created: 2026-04-03 11:42 - Last Modified: 2025-11-01 12:18 - 5.9K bytes - Click Count (1)