Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KTOR-4419 Ignore request timeout for WebSocket requests (#3062)
- Loading branch information
Showing
6 changed files
with
89 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
ktor-client/ktor-client-cio/jvmAndNix/test/CIOEngineTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
import io.ktor.client.* | ||
import io.ktor.client.engine.cio.* | ||
import io.ktor.client.plugins.websocket.* | ||
import io.ktor.client.tests.utils.* | ||
import io.ktor.websocket.* | ||
import kotlinx.coroutines.* | ||
import kotlin.test.* | ||
|
||
class CIOEngineTest { | ||
|
||
@Test | ||
fun testRequestTimeoutIgnoredWithWebSocket(): Unit = runBlocking { | ||
val client = HttpClient(CIO) { | ||
engine { | ||
requestTimeout = 10 | ||
} | ||
|
||
install(WebSockets) | ||
} | ||
|
||
var received = false | ||
client.ws("$TEST_WEBSOCKET_SERVER/websockets/echo") { | ||
delay(20) | ||
|
||
send(Frame.Text("Hello")) | ||
|
||
val response = incoming.receive() as Frame.Text | ||
received = true | ||
assertEquals("Hello", response.readText()) | ||
} | ||
|
||
assertTrue(received) | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
ktor-client/ktor-client-cio/jvmAndNix/test/EndpointTest.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters