diff --git a/kotlin-sdk-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/WebSocketIntegrationTest.kt b/kotlin-sdk-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/kotlin/websocket/WebSocketIntegrationTest.kt similarity index 91% rename from kotlin-sdk-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/WebSocketIntegrationTest.kt rename to kotlin-sdk-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/kotlin/websocket/WebSocketIntegrationTest.kt index 2a815dd0..6200e083 100644 --- a/kotlin-sdk-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/WebSocketIntegrationTest.kt +++ b/kotlin-sdk-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/kotlin/websocket/WebSocketIntegrationTest.kt @@ -1,4 +1,4 @@ -package io.modelcontextprotocol.kotlin.sdk.integration +package io.modelcontextprotocol.kotlin.sdk.integration.kotlin.websocket import io.ktor.client.HttpClient import io.ktor.server.application.install @@ -22,7 +22,6 @@ import io.modelcontextprotocol.kotlin.sdk.server.mcpWebSocket import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.test.runTest import kotlinx.coroutines.withContext -import kotlin.test.Ignore import kotlin.test.Test import kotlin.test.assertTrue import kotlin.time.Duration.Companion.seconds @@ -34,7 +33,6 @@ import io.ktor.server.websocket.WebSockets as ServerWebSockets class WebSocketIntegrationTest { @Test - @Ignore // Ignored because it doesn’t work with wasm/js in Ktor 3.2.3 fun `client should be able to connect to websocket server 2`() = runTest(timeout = 5.seconds) { var server: EmbeddedServer? = null var client: Client? = null @@ -47,7 +45,7 @@ class WebSocketIntegrationTest { } } finally { client?.close() - server?.stopSuspend(1000, 2000) + server?.stop(1000, 2000) } } @@ -59,7 +57,6 @@ class WebSocketIntegrationTest { * 3. Observe that Client A receives a response related to it. */ @Test - @Ignore // Ignored because it doesn’t work with wasm/js in Ktor 3.2.3 fun `single websocket connection`() = runTest(timeout = 5.seconds) { var server: EmbeddedServer? = null var client: Client? = null @@ -75,7 +72,7 @@ class WebSocketIntegrationTest { } } finally { client?.close() - server?.stopSuspend(1000, 2000) + server?.stop(1000, 2000) } } @@ -88,7 +85,6 @@ class WebSocketIntegrationTest { * 4. Observe that Client B (connection #2) receives a response related to sessionId#1. */ @Test - @Ignore // Ignored because it doesn’t work with wasm/js in Ktor 3.2.3 fun `multiple websocket connections`() = runTest(timeout = 5.seconds) { var server: EmbeddedServer? = null var clientA: Client? = null @@ -112,7 +108,7 @@ class WebSocketIntegrationTest { } finally { clientA?.close() clientB?.close() - server?.stopSuspend(1000, 2000) + server?.stop(1000, 2000) } } @@ -138,7 +134,7 @@ class WebSocketIntegrationTest { return client } - private suspend fun initServer(): EmbeddedServer { + private fun initServer(): EmbeddedServer { val server = Server( Implementation(name = "websocket-server", version = "1.0.0"), ServerOptions( @@ -175,7 +171,7 @@ class WebSocketIntegrationTest { } } - return ktorServer.startSuspend(wait = false) + return ktorServer.start(wait = false) } /**