RFR: 8377675: java.net.http tests should not depend on ../../../com/sun/net/httpserver test classes
Jaikiran Pai
jpai at openjdk.org
Fri Feb 13 10:07:03 UTC 2026
On Thu, 12 Feb 2026 19:02:54 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
> Some HttpClient tests - like `test/jdk/java/net/httpclient/SmokeTest.java`, depend on non-library test classes that were developed for testing the HttpServer, such as `../../../com/sun/net/httpserver/FileServerHandler.java` which requires compiling using `@compile`.
>
> Instead of depending on HttpServer test classes, these tests should use functionalities from the common servers provided by the `HttpServerAdapters`, offered by the `test/jdk/java/net/httpclient/lib` library. An adapted version of the `../../../com/sun/net/httpserver/FileServerHandler.java` could be provided by the `HttpServerAdapters` helper.
>
> There are also 5 implementations of stand-alone echo handlers in the httpclient test base. This change remove 4 of them, keep only the implementation in `HttpServerAdapters`, and updates all tests that were relying on the removed implementations to use that provided by `HttpServerAdapters`.
>
> This is a test-only change.
Hello Daniel, overall this looks good to me. Thank you for cleaning this up.
Some of the files will require a copyright year update.
test/jdk/java/net/httpclient/http2/BasicTest.java line 228:
> 226: String prot = s.getProtocol();
> 227: if (prot.equals("TLSv1.2") || prot.equals("TLSv1.3")) {
> 228: t.sendResponseHeaders(200, HttpTestExchange.RSPBODY_EMPTY);
The -1 and 0 are always confusing. I see that previously we used to send -1 here and we now send 0 here but at the same time the exchange type has changed. So I believe this is the right change.
-------------
PR Review: https://git.openjdk.org/jdk/pull/29702#pullrequestreview-3796274479
PR Review Comment: https://git.openjdk.org/jdk/pull/29702#discussion_r2803349459
More information about the net-dev
mailing list