Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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<CIOApplicationEngine, CIOApplicationEngine.Configuration>? = null
var client: Client? = null
Expand All @@ -47,7 +45,7 @@ class WebSocketIntegrationTest {
}
} finally {
client?.close()
server?.stopSuspend(1000, 2000)
server?.stop(1000, 2000)
}
}

Expand All @@ -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<CIOApplicationEngine, CIOApplicationEngine.Configuration>? = null
var client: Client? = null
Expand All @@ -75,7 +72,7 @@ class WebSocketIntegrationTest {
}
} finally {
client?.close()
server?.stopSuspend(1000, 2000)
server?.stop(1000, 2000)
}
}

Expand All @@ -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<CIOApplicationEngine, CIOApplicationEngine.Configuration>? = null
var clientA: Client? = null
Expand All @@ -112,7 +108,7 @@ class WebSocketIntegrationTest {
} finally {
clientA?.close()
clientB?.close()
server?.stopSuspend(1000, 2000)
server?.stop(1000, 2000)
}
}

Expand All @@ -138,7 +134,7 @@ class WebSocketIntegrationTest {
return client
}

private suspend fun initServer(): EmbeddedServer<CIOApplicationEngine, CIOApplicationEngine.Configuration> {
private fun initServer(): EmbeddedServer<CIOApplicationEngine, CIOApplicationEngine.Configuration> {
val server = Server(
Implementation(name = "websocket-server", version = "1.0.0"),
ServerOptions(
Expand Down Expand Up @@ -175,7 +171,7 @@ class WebSocketIntegrationTest {
}
}

return ktorServer.startSuspend(wait = false)
return ktorServer.start(wait = false)
}

/**
Expand Down
Loading