Initial commit
This commit is contained in:
parent
71ae106311
commit
7b32c3e3da
1 changed files with 7267 additions and 5 deletions
39
src/test/kotlin/client/ClientIntegrationTest.kt
Normal file
39
src/test/kotlin/client/ClientIntegrationTest.kt
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package client
|
||||
|
||||
import org.jetbrains.kotlinx.mcp.Implementation
|
||||
import org.jetbrains.kotlinx.mcp.ListToolsResult
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.jetbrains.kotlinx.mcp.client.Client
|
||||
import org.jetbrains.kotlinx.mcp.client.StdioClientTransport
|
||||
import org.junit.jupiter.api.Disabled
|
||||
import org.junit.jupiter.api.Test
|
||||
import java.net.Socket
|
||||
|
||||
class ClientIntegrationTest {
|
||||
|
||||
fun createTransport(): StdioClientTransport {
|
||||
val socket = Socket("localhost", 3000)
|
||||
|
||||
return StdioClientTransport(socket.inputStream, socket.outputStream)
|
||||
}
|
||||
|
||||
@Disabled("This test requires a running server")
|
||||
@Test
|
||||
fun testRequestTools() = runTest {
|
||||
val client = Client(
|
||||
Implementation("test", "1.0"),
|
||||
)
|
||||
|
||||
val transport = createTransport()
|
||||
try {
|
||||
client.connect(transport)
|
||||
|
||||
val response: ListToolsResult? = client.listTools()
|
||||
println(response?.tools)
|
||||
|
||||
} finally {
|
||||
transport.close()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue