Skip to content

Commit

Permalink
fixup! KTOR-2036 Fix CIO connection limit
Browse files Browse the repository at this point in the history
  • Loading branch information
e5l committed Aug 31, 2022
1 parent 82ac773 commit 01c2830
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -5,6 +5,7 @@
package io.ktor.client.engine.cio

import io.ktor.client.call.*
import io.ktor.client.network.sockets.*
import io.ktor.client.plugins.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
Expand Down Expand Up @@ -147,13 +148,19 @@ class CIORequestTest : TestWithKtor() {
}

test { client ->
var fail: Throwable? = null
for (i in 0..1000) {
try {
client.get("http://something.wrong").body<String>()
} catch (cause: UnresolvedAddressException) {
// ignore
} catch (cause: Throwable) {
fail = cause
}
}

assertNotNull(fail)
if (fail !is ConnectTimeoutException && fail !is UnresolvedAddressException) {
fail("Expected ConnectTimeoutException or UnresolvedAddressException, got $fail", fail)
}
}
}
}

0 comments on commit 01c2830

Please sign in to comment.