RFR: JDK-8268464 : Remove dependancy of TestHttpsServer, HttpTransaction, HttpCallback from open/test/jdk/sun/net/www/protocol/https/ tests [v3]

Daniel Fuchs dfuchs at openjdk.java.net
Fri Jun 11 14:04:50 UTC 2021


On Fri, 11 Jun 2021 13:38:14 GMT, Mahendra Chhipa <github.com+34924738+mahendrachhipa at openjdk.org> wrote:

>> …HttpCallback from open/test/jdk/sun/net/www/protocol/https/ tests
>
> Mahendra Chhipa has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove extra space.

test/jdk/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java line 89:

> 87:             // created as it will use an ephemeral port.
> 88:             System.setProperty("https.proxyPort",
> 89:                         Integer.toString(proxy.getLocalPort()));

A potentially better alternative to setting system properties in main could be to set a ProxySelector (using ProxySelector.setDefault());

test/jdk/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java line 184:

> 182:         HttpURLConnection uc = (HttpURLConnection)url.openConnection();
> 183:         System.out.println(uc.getResponseCode());
> 184:         if(uc.getResponseCode() == 400) {

It could be better to use: `uc.getResponseCode() != 200` here - since anything but 200 should be an error?

test/jdk/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java line 186:

> 184:         if(uc.getResponseCode() == 400) {
> 185:             uc.disconnect();
> 186:             throw new RuntimeException("Test failed : bad http request");

Maybe add the response code to the exception message.

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

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



More information about the security-dev mailing list