diff -r 71b78a44c698 -r f8b3f053cfbb src/java.net.http/share/classes/jdk/internal/net/http/PlainTunnelingConnection.java --- a/src/java.net.http/share/classes/jdk/internal/net/http/PlainTunnelingConnection.java Mon Apr 16 13:57:06 2018 +0100 +++ b/src/java.net.http/share/classes/jdk/internal/net/http/PlainTunnelingConnection.java Mon Apr 16 16:44:12 2018 +0100 @@ -61,10 +61,10 @@ @Override public CompletableFuture connectAsync() { - debug.log(Level.DEBUG, "Connecting plain connection"); + if (debug.on()) debug.log("Connecting plain connection"); return delegate.connectAsync() .thenCompose((Void v) -> { - debug.log(Level.DEBUG, "sending HTTP/1.1 CONNECT"); + if (debug.on()) debug.log("sending HTTP/1.1 CONNECT"); HttpClientImpl client = client(); assert client != null; HttpRequestImpl req = new HttpRequestImpl("CONNECT", address, proxyHeaders); @@ -76,7 +76,7 @@ .responseAsyncImpl(delegate) .thenCompose((Response resp) -> { CompletableFuture cf = new MinimalFuture<>(); - debug.log(Level.DEBUG, "got response: %d", resp.statusCode()); + if (debug.on()) debug.log("got response: %d", resp.statusCode()); if (resp.statusCode() == 407) { return connectExchange.ignoreBody().handle((r,t) -> { // close delegate after reading body: we won't