Register ping handler in McpSessionHandler to support server-initiated pings (#1391)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> Co-authored-by: Stephen Toub <stoub@microsoft.com>
This commit is contained in:
parent
1108117d6f
commit
919e8383f0
1 changed files with 20 additions and 9 deletions
|
|
@ -782,4 +782,16 @@ public class McpClientTests : ClientServerTestBase
|
|||
await Assert.ThrowsAsync<ArgumentNullException>("requestParams",
|
||||
() => client.SetLoggingLevelAsync((SetLevelRequestParams)null!, TestContext.Current.CancellationToken));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ServerCanPingClient()
|
||||
{
|
||||
await using McpClient client = await CreateMcpClientForServer();
|
||||
|
||||
var pingRequest = new JsonRpcRequest { Method = RequestMethods.Ping };
|
||||
var response = await Server.SendRequestAsync(pingRequest, TestContext.Current.CancellationToken);
|
||||
|
||||
Assert.NotNull(response);
|
||||
Assert.NotNull(response.Result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue