On Wed, 23 Nov 2022 14:21:13 GMT, Darragh Clarke <[email protected]> wrote:
> Currently if a `HttpResonseInputStream` gets interrupted while reading it
> will just swallow the exception and continue,
>
> This PR changes it to close the stream and throw an IOException, I added a
> test to cover this which just uses two threads to read the stream then
> interrupt it.
test/jdk/java/net/httpclient/HttpResponseInputStreamInterruptTest.java line 71:
> 69: port = server.getAddress().getPort();
> 70: Handler handler = new Handler(countDownLatch, interruptLatch);
> 71: server.createContext("/", handler);
It would be good to use a path unique for this test to avoid potential
interferences. I would suggest registering the context under
"/HttpResponseInputStreamInterruptTest/" instead of "/".
And use that when building the URI below as well.
This is important because the handler is using latches, and therefore can be
invoked only once...
-------------
PR: https://git.openjdk.org/jdk/pull/11323