On Thu, 24 Feb 2022 16:01:57 GMT, Mahendra Chhipa <d...@openjdk.java.net> wrote:

> Updated following remaining tests to remove depenedies of TestHttpServer, 
> HttpTransaction, HttpCallback
> open/test/jdk/java/net/ProxySelector/LoopbackAddresses.java
> open/test/jdk/java/net/ProxySelector/ProxyTest.java
> open/test/jdk/java/net/URL/PerConnectionProxy.java
> open/test/jdk/java/net/URLConnection/B5052093.java
> open/test/jdk/sun/net/www/AuthHeaderTest.java
> open/test/jdk/sun/net/www/http/KeepAliveCache/B5045306.java

test/jdk/java/net/ProxySelector/LoopbackAddresses.java line 78:

> 76:             // hard guarantee.
> 77:             server = HttpServer.create(new InetSocketAddress(loopback, 
> 0), 10);
> 78:             server.createContext("/", new LoopbackAddresses());

While here, we could use the new 
[HttpServer::create](https://download.java.net/java/early_access/jdk18/docs/api/jdk.httpserver/com/sun/net/httpserver/HttpServer.html#create(java.net.InetSocketAddress,int,java.lang.String,com.sun.net.httpserver.HttpHandler,com.sun.net.httpserver.Filter...))
 overload that creates a server with a context (applies to all tests touched.) 

I also wonder if it would make sense to change the names of the classes that 
implement HttpHandler to "xyzHandler" for readability, and to create a separate 
class for the handler instead of using the test class.

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

PR: https://git.openjdk.java.net/jdk/pull/7616

Reply via email to