RFR: 8377675: java.net.http tests should not depend on ../../../com/sun/net/httpserver test classes

Daniel Fuchs dfuchs at openjdk.org
Fri Feb 13 10:12:21 UTC 2026


On Fri, 13 Feb 2026 10:00:03 GMT, Jaikiran Pai <jpai 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.
>
> 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.

Yes - it is sending an enpty response.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29702#discussion_r2803398856


More information about the net-dev mailing list