如何测试客户端可以保持 HTTPS 连接打开多长时间?
我正在针对一个 API 进行开发,其文档表明客户端代码必须能够保持 HTTPS 连接打开长达 15 秒
我希望能够以编程方式确认此标准,最好通过在每个构建上运行的集成测试并在通过之前保持连接打开 15 秒。 (除非 C# WebRequests 在某个地方保证它们能够保持连接打开那么长时间)
有没有办法做到这一点?
I am developing against an API whose documentation says that the client code must be able to hold an HTTPS connection open for up to 15 seconds
I would like to be able to confirm this criterion programatically, preferably by having an integration test that runs on every build and holds the connection open for 15sec before passing. (Unless C# WebRequests guarantee somewhere that they will be able to hold the connection open for that long)
Is there a way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个两方面的事情;服务器必须支持它,并且客户端可能需要设置某种 KeepAlive 标志。 参见此处。
该示例将 KeepAlive 设置为 false ;您希望将其设置为
true。
摘自 MSDN:
This a 2 way thing; the server has to support it and the client probably needs to set some sort of KeepAlive flag. See here.
That example sets KeepAlive to false; you'd want it set to
true.
Excerpt from MSDN: