File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
integration-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -6,12 +6,13 @@ import io.modelcontextprotocol.kotlin.sdk.server.mcpWebSocket
66import io.modelcontextprotocol.kotlin.sdk.server.mcpWebSocketTransport
77import io.modelcontextprotocol.kotlin.sdk.shared.BaseTransportTest
88import kotlinx.coroutines.CompletableDeferred
9- import kotlin.test.Ignore
10- import kotlin.test.Test
9+ import org.junit.jupiter.api.Test
10+ import org.junit.jupiter.api.Timeout
11+ import java.util.concurrent.TimeUnit
1112
13+ @Timeout(30 , unit = TimeUnit .SECONDS )
1214class WebSocketTransportTest : BaseTransportTest () {
1315 @Test
14- @Ignore // "Test disabled for investigation #17"
1516 fun `should start then close cleanly` () = testApplication {
1617 install(WebSockets )
1718 routing {
@@ -26,7 +27,6 @@ class WebSocketTransportTest : BaseTransportTest() {
2627 }
2728
2829 @Test
29- @Ignore // "Test disabled for investigation #17"
3030 fun `should read messages` () = testApplication {
3131 val clientFinished = CompletableDeferred <Unit >()
3232
Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ import io.ktor.websocket.close
77import io.ktor.websocket.readText
88import io.modelcontextprotocol.kotlin.sdk.types.JSONRPCMessage
99import io.modelcontextprotocol.kotlin.sdk.types.McpJson
10+ import kotlinx.coroutines.CancellationException
1011import kotlinx.coroutines.CoroutineName
1112import kotlinx.coroutines.CoroutineScope
12- import kotlinx.coroutines.InternalCoroutinesApi
1313import kotlinx.coroutines.SupervisorJob
1414import kotlinx.coroutines.channels.ClosedReceiveChannelException
1515import kotlinx.coroutines.job
@@ -80,9 +80,8 @@ public abstract class WebSocketMcpTransport : AbstractTransport() {
8080 }
8181 }
8282
83- @OptIn(InternalCoroutinesApi ::class )
8483 session.coroutineContext.job.invokeOnCompletion {
85- if (it != null ) {
84+ if (it != null && it !is CancellationException ) {
8685 _onError .invoke(it)
8786 } else {
8887 invokeOnCloseCallback()
You can’t perform that action at this time.
0 commit comments