On Tue, 6 Sep 2022 13:56:15 GMT, Conor Cleary <ccle...@openjdk.org> wrote:

> **Issue**
> When using HTTP/2 with the HttpClient, it can often be necessary to close an 
> idle Http2 Connection before a server sends a GOAWAY frame. For example, a 
> server or cloud based tool could close a TCP connection silently when it is 
> idle for too long resulting in ConnectionResetException being thrown by the 
> HttpClient.
> 
> **Proposed Solution**
> A new system property, `jdk.httpclient.idleConnectionTimeout`, was added and 
> is used to specify in Milliseconds how long an idle connection (idle 
> connections are those which have no currently active streams) for the 
> HttpClient before the connection is closed.

test/jdk/java/net/httpclient/http2/IdleConnectionTimeoutTest.java line 94:

> 92:         assertEquals(hresp.statusCode(), 200);
> 93:         // Sleep for 4x the timeout value to ensure that it occurs
> 94:         Thread.sleep(800);

Should this use the `Utils.adjustTimeout` to take into account the 
`TIMEOUT_FACTOR`?

test/jdk/java/net/httpclient/http2/IdleConnectionTimeoutTest.java line 157:

> 155:                 exchange.sendResponseHeaders(200, 0);
> 156:             } else {
> 157:                 exchange.sendResponseHeaders(400, 0);

Would it be useful to include a log message here which prints the expected 
(old) client address and the new client address, when it fails?

-------------

PR: https://git.openjdk.org/jdk/pull/10183

Reply via email to