1- package io.modelcontextprotocol.kotlin.sdk.integration
1+ package io.modelcontextprotocol.kotlin.sdk.integration.kotlin.websocket
22
33import io.ktor.client.HttpClient
44import io.ktor.server.application.install
@@ -22,7 +22,6 @@ import io.modelcontextprotocol.kotlin.sdk.server.mcpWebSocket
2222import kotlinx.coroutines.Dispatchers
2323import kotlinx.coroutines.test.runTest
2424import kotlinx.coroutines.withContext
25- import kotlin.test.Ignore
2625import kotlin.test.Test
2726import kotlin.test.assertTrue
2827import kotlin.time.Duration.Companion.seconds
@@ -34,7 +33,6 @@ import io.ktor.server.websocket.WebSockets as ServerWebSockets
3433class WebSocketIntegrationTest {
3534
3635 @Test
37- @Ignore // Ignored because it doesn’t work with wasm/js in Ktor 3.2.3
3836 fun `client should be able to connect to websocket server 2` () = runTest(timeout = 5 .seconds) {
3937 var server: EmbeddedServer <CIOApplicationEngine , CIOApplicationEngine .Configuration >? = null
4038 var client: Client ? = null
@@ -47,7 +45,7 @@ class WebSocketIntegrationTest {
4745 }
4846 } finally {
4947 client?.close()
50- server?.stopSuspend (1000 , 2000 )
48+ server?.stop (1000 , 2000 )
5149 }
5250 }
5351
@@ -59,7 +57,6 @@ class WebSocketIntegrationTest {
5957 * 3. Observe that Client A receives a response related to it.
6058 */
6159 @Test
62- @Ignore // Ignored because it doesn’t work with wasm/js in Ktor 3.2.3
6360 fun `single websocket connection` () = runTest(timeout = 5 .seconds) {
6461 var server: EmbeddedServer <CIOApplicationEngine , CIOApplicationEngine .Configuration >? = null
6562 var client: Client ? = null
@@ -75,7 +72,7 @@ class WebSocketIntegrationTest {
7572 }
7673 } finally {
7774 client?.close()
78- server?.stopSuspend (1000 , 2000 )
75+ server?.stop (1000 , 2000 )
7976 }
8077 }
8178
@@ -88,7 +85,6 @@ class WebSocketIntegrationTest {
8885 * 4. Observe that Client B (connection #2) receives a response related to sessionId#1.
8986 */
9087 @Test
91- @Ignore // Ignored because it doesn’t work with wasm/js in Ktor 3.2.3
9288 fun `multiple websocket connections` () = runTest(timeout = 5 .seconds) {
9389 var server: EmbeddedServer <CIOApplicationEngine , CIOApplicationEngine .Configuration >? = null
9490 var clientA: Client ? = null
@@ -112,7 +108,7 @@ class WebSocketIntegrationTest {
112108 } finally {
113109 clientA?.close()
114110 clientB?.close()
115- server?.stopSuspend (1000 , 2000 )
111+ server?.stop (1000 , 2000 )
116112 }
117113 }
118114
@@ -138,7 +134,7 @@ class WebSocketIntegrationTest {
138134 return client
139135 }
140136
141- private suspend fun initServer (): EmbeddedServer <CIOApplicationEngine , CIOApplicationEngine .Configuration > {
137+ private fun initServer (): EmbeddedServer <CIOApplicationEngine , CIOApplicationEngine .Configuration > {
142138 val server = Server (
143139 Implementation (name = " websocket-server" , version = " 1.0.0" ),
144140 ServerOptions (
@@ -175,7 +171,7 @@ class WebSocketIntegrationTest {
175171 }
176172 }
177173
178- return ktorServer.startSuspend (wait = false )
174+ return ktorServer.start (wait = false )
179175 }
180176
181177 /* *
0 commit comments