diff -r d3aa93570779 -r a47b8125b7cc test/jdk/java/net/httpclient/DigestEchoServer.java --- a/test/jdk/java/net/httpclient/DigestEchoServer.java Wed Jan 16 10:12:58 2019 -0800 +++ b/test/jdk/java/net/httpclient/DigestEchoServer.java Wed Jan 16 19:09:16 2019 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,7 @@ import java.net.PasswordAuthentication; import java.net.ServerSocket; import java.net.Socket; +import java.net.StandardSocketOptions; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; @@ -77,6 +78,8 @@ public static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("test.debug", "false")); + public static final boolean NO_LINGER = + Boolean.parseBoolean(System.getProperty("test.nolinger", "false")); public enum HttpAuthType { SERVER, PROXY, SERVER307, PROXY305 /* add PROXY_AND_SERVER and SERVER_PROXY_NONE */ @@ -1603,6 +1606,11 @@ Socket toClose; try { toClose = clientConnection = ss.accept(); + if (NO_LINGER) { + // can be useful to trigger "Connection reset by peer" + // errors on the client side. + clientConnection.setOption(StandardSocketOptions.SO_LINGER, 0); + } } catch (IOException io) { if (DEBUG || !stopped) io.printStackTrace(System.out); break;