Refactor onCloseCallback to onClose and update related usages across the codebase (#62)

This commit is contained in:
Pavel Gorgulov 2025-03-26 15:04:28 +01:00 • committed by GitHub
commit 1c5e54936d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 24 deletions

View file

@ -30,7 +30,6 @@ public class ServerOptions(
*
* @param serverInfo Information about this server implementation (name, version).
* @param options Configuration options for the server.
* @param onCloseCallback A callback invoked when the server connection closes.
*/
public open class Server(
private val serverInfo: Implementation,
@ -127,7 +126,6 @@ public open class Server(
/**
* Called when the server connection is closing.
* Invokes [onCloseCallback] if set.
*/
override fun onClose() {
logger.info { "Server connection closing" }

View file

@ -1,6 +1,5 @@
import io.modelcontextprotocol.kotlin.sdk.JSONRPCMessage
import io.modelcontextprotocol.kotlin.sdk.shared.AbstractTransport
import io.modelcontextprotocol.kotlin.sdk.shared.Transport
/**
* In-memory transport for creating clients and servers that talk to each other within the same process.

View file

@ -96,11 +96,9 @@ class InMemoryTransportTest {
clientTransport.close()
assertThrows<IllegalStateException> {
runBlocking {
clientTransport.send(
InitializedNotification().toJSON()
)
}
clientTransport.send(
InitializedNotification().toJSON()
)
}
}
}