gpt4 book ai didi

java - Jetty http/2 客户端挂起获取 url

转载 作者:行者123 更新时间:2023-12-02 13:02:07 25 4
gpt4 key购买 nike

我有一个代码(实际上是从 jetty-project repo 复制的):

HTTP2Client http2Client = new HTTP2Client();
SslContextFactory sslContextFactory = new SslContextFactory();
HttpClient httpClient = new HttpClient(new HttpClientTransportOverHTTP2(http2Client), sslContextFactory);
Executor executor = new QueuedThreadPool();
httpClient.setExecutor(executor);
httpClient.start();

ContentResponse response = httpClient.GET("https://www.google.com/");

由于某种原因,它无限等待响应。它有什么问题吗?我正在寻找 http/2 客户端使用来访问某些 https url 的工作示例。谢谢!

最佳答案

您可能没有配置 ALPN。

请引用ALPN documentation为运行客户端代码的 JVM 启用 ALPN。

关于java - Jetty http/2 客户端挂起获取 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44246385/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com