On Wed, 26 Aug 2026 12:32:19 GMT, Lee Jiwon <[email protected]> wrote:
> Replaces the fixed delay in `IsAvailable.java` with reads from the socket > used by `HttpClient::available`. > The tests wait for EOF or data on that socket before invoking the existing > `HttpClient::available` assertion. > > No production code is changed. > > Testing: > - `make test TEST='test/jdk/sun/net/www/http/HttpClient/IsAvailable.java' > JTREG='REPEAT_COUNT=200;VERBOSE=summary;RETAIN=fail'` (200/200 passed) > - `make test TEST='test/jdk/sun/net/www/http/HttpClient/IsAvailable.java' > JTREG='VERBOSE=summary;RETAIN=fail;VM_OPTIONS=-Dsun.net.client.defaultReadTimeout=200'` > (passed) > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). test/jdk/sun/net/www/http/HttpClient/IsAvailable.java line 188: > 186: } > 187: > 188: private static MethodHandle findServerSocketAccessor() { Similar to `findAvailableAccessor()`, can you make this method return a `Function<HttpClient,Socket>`, please? This avoids leaking the `MethodHandle` internal detail. test/jdk/sun/net/www/http/HttpClient/IsAvailable.java line 238: > 236: > 237: private void awaitEof() throws IOException { > 238: assertEquals(-1, readFromHttpClientSocket(), This is only used at one place. Instead of defining a new method, just inline this `assertEquals()` at the call-site. test/jdk/sun/net/www/http/HttpClient/IsAvailable.java line 246: > 244: int timeout = socket.getSoTimeout(); > 245: try { > 246: socket.setSoTimeout((int) adjustTimeout(500)); Tests run on several of platforms with varying configurations. I suggest relaxing this wait time to 5s: Suggestion: socket.setSoTimeout((int) adjustTimeout(5000)); On the happy path, `socket.getInputStream().read()` should complete in a couple of milliseconds. SO timeout just establishes a limit. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32539#discussion_r3866127338 PR Review Comment: https://git.openjdk.org/jdk/pull/32539#discussion_r3866133248 PR Review Comment: https://git.openjdk.org/jdk/pull/32539#discussion_r3869918433
