[9] RFR: 8156710: HttpTimeoutException should be thrown if server doesn't respond

Artem Smotrakov artem.smotrakov at oracle.com
Thu May 12 21:10:09 UTC 2016


Hello,

Please review this for 9.

Stream.getResponse() method can hang because it calls join() method 
without any timeout. It would be better if it took into account a 
timeout value specified for a connection, and threw HttpTimeoutException 
if timeout was reached.

The patch updates Stream.getResponse() method to use 
CompletableFuture.get() method with timeout if a timeout value was 
specified for HTTPRequest.

Timeout.java test starts a TLS server which just reads incoming data, 
but doesn't reply anything. The client sets a timeout with 
HTTPRequestBuilder.Builder.timeout() method, and then expects 
HttpTimeoutException.

The test initializes JSSE with standard way by system properties. RSA 
keys are located in keystore.p12 which can be re-used by other tests. 
The keys were created by the following command:

keytool -genkey -alias rsa2048keypair -keystore keystore.p12 -storepass 
password -keypass password -validity 3650 -keysize 2048 -dname "CN=Test 
RSA 2048 key"

Bug: https://bugs.openjdk.java.net/browse/JDK-8156710
Webrev: http://cr.openjdk.java.net/~asmotrak/8156710/webrev.01/

Artem


More information about the net-dev mailing list