Skip to content

Commit c38ad2d

Browse files
AdrianMiskakpavlov
authored andcommitted
add dispatcher again
1 parent 8d706cf commit c38ad2d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

kotlin-sdk-client/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/StreamableHttpClientTransportTest.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ import io.modelcontextprotocol.kotlin.sdk.JSONRPCNotification
1818
import io.modelcontextprotocol.kotlin.sdk.JSONRPCRequest
1919
import io.modelcontextprotocol.kotlin.sdk.RequestId
2020
import io.modelcontextprotocol.kotlin.sdk.shared.McpJson
21+
import kotlinx.coroutines.Dispatchers
2122
import kotlinx.coroutines.TimeoutCancellationException
2223
import kotlinx.coroutines.delay
2324
import kotlinx.coroutines.test.runTest
25+
import kotlinx.coroutines.withContext
2426
import kotlinx.coroutines.withTimeout
2527
import kotlinx.serialization.json.JsonObject
2628
import kotlinx.serialization.json.JsonPrimitive
@@ -405,10 +407,11 @@ class StreamableHttpClientTransportTest {
405407

406408
runCatching {
407409
// Real time-keeping is needed; otherwise Protocol will always throw TimeoutCancellationException in tests
408-
withTimeout(5.seconds) {
409-
client.connect(transport)
410+
withContext(Dispatchers.Default.limitedParallelism(1)) {
411+
withTimeout(5.seconds) {
412+
client.connect(transport)
413+
}
410414
}
411-
412415
}.onSuccess {
413416
fail("Expected client.connect to fail on invalid JSON response")
414417
}.onFailure { e ->

0 commit comments

Comments
 (0)