- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我知道 HTTP/2 Client provided by Java 9并在使用以下代码试用孵化器模块时:
// Request builder
URI uri = new URI("http://www.stackoverflow.com/"); // using www.google.com gives me some payload with no exception
HttpRequest request = HttpRequest.newBuilder().uri(uri).GET().build();
// Client
HttpClient httpClient = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.ALWAYS).build();
System.out.println(httpClient.version());
// Response builder
HttpResponse response = httpClient.send(request, HttpResponse.BodyHandler.asString());
System.out.println("statusCode = " + response.statusCode()); // 200 for google.com
我收到了这个作为输出:
Exception in thread "main" java.io.IOException: /192.168.0.2:60726: GOAWAY received
at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.handleGoAway(Http2Connection.java:613)
at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.handleConnectionFrame(Http2Connection.java:531)
at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.processFrame(Http2Connection.java:466)
at jdk.incubator.httpclient/jdk.incubator.http.internal.frame.FramesDecoder.decode(FramesDecoder.java:114)
at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection$FramesController.processReceivedData(Http2Connection.java:152)
at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.asyncReceive(Http2Connection.java:425)
at jdk.incubator.httpclient/jdk.incubator.http.AsyncSSLDelegate.upperRead(AsyncSSLDelegate.java:557)
at jdk.incubator.httpclient/jdk.incubator.http.internal.common.Queue.put(Queue.java:73)
at jdk.incubator.httpclient/jdk.incubator.http.AsyncSSLDelegate.asyncReceive(AsyncSSLDelegate.java:503)
at jdk.incubator.httpclient/jdk.incubator.http.PlainHttpConnection.asyncRead(PlainHttpConnection.java:300)
at jdk.incubator.httpclient/jdk.incubator.http.PlainHttpConnection$ReadEvent.handle(PlainHttpConnection.java:395)
at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.handleEvent(HttpClientImpl.java:438)
at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:408)
向下移动堆栈跟踪,我可以找到 GOAWAY
列为
jdk.incubator.http.internal.frame.Http2Frame
但是内部类并没有太多的文档来准确地找到这个类型代表什么。我也尝试在 JEP 的链接上搜索相同内容,但找不到任何内容。
问。 什么是 GoAway 框架?何时以及如何使用它?
问。为什么如果我更改我的代码以使用客户端而不遵循尝试获取“stackoverflow.com”的重定向,我不会得到相同的异常?
HttpClient httpClient = HttpClient.newBuilder().build();
最佳答案
在 specifications 中设置,
The GOAWAY frame (type=0x7) is used to initiate graceful shutdown ofa connection by a server.
很可能该帧是由服务器在重定向后的第二个连接上发送的。
stackoverflow.com 上的所有 URL 都接受 http/2 连接吗?当查看我的 HTTP/2-SPDY 浏览器插件的指示器时,情况似乎并非如此。
关于java - 什么是 Http2 中的 GoAway 框架以及它如何链接到重定向?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46398964/
我知道 HTTP/2 Client provided by Java 9并在使用以下代码试用孵化器模块时: // Request builder URI uri = new URI("http://w
我正在尝试每隔几分钟向 REST API 连续发送 GET 和 POST 请求。问题是在恰好 1000 个请求之后我收到一个 GOAWAY框架(和 IOException): The GOAWAY f
我有一个 for 循环,在这个循环中我调用了从 osrm 服务器获取响应的函数,一段时间后 ioutil.ReadAll(resp.Body) 返回打印 http2: server sent GOAW
我们最近从 ELB 切换到 ELB2/ALB,偶尔我们的 go http/2 客户端会看到 GOAWAY来 self 们的 Application Load Balancer 的消息,我无法解释。目标
我正在应用程序中进行 API 调用,在某些时候它会随机抛出 java.io.IOException: /149.222.1.1:553232: GOAWAY received , 使用 Java 11
我是一名优秀的程序员,十分优秀!