diff --git a/ktor-client/ktor-client-cio/jvm/test/io/ktor/client/engine/cio/CIORequestTest.kt b/ktor-client/ktor-client-cio/jvm/test/io/ktor/client/engine/cio/CIORequestTest.kt index 6d1b962a79b..0bdca5a9317 100644 --- a/ktor-client/ktor-client-cio/jvm/test/io/ktor/client/engine/cio/CIORequestTest.kt +++ b/ktor-client/ktor-client-cio/jvm/test/io/ktor/client/engine/cio/CIORequestTest.kt @@ -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.* @@ -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() - } 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) + } } } }