|
1 | 1 | /* |
2 | | - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
|
25 | 25 | import com.sun.net.httpserver.HttpExchange; |
26 | 26 | import com.sun.net.httpserver.HttpHandler; |
27 | 27 | import com.sun.net.httpserver.HttpServer; |
| 28 | +import jdk.httpclient.test.lib.common.HttpServerAdapters; |
| 29 | + |
28 | 30 | import java.io.IOException; |
29 | 31 | import java.io.InputStream; |
30 | 32 | import java.net.HttpURLConnection; |
|
54 | 56 | * @bug 8230526 |
55 | 57 | * @summary Verifies that PlainProxyConnections are cached and reused properly. We do this by |
56 | 58 | * verifying that the remote address of the HTTP exchange (on the fake proxy server) |
57 | | - * is always the same InetSocketAddress. |
58 | | - * @modules jdk.httpserver |
59 | | - * @run main/othervm -Djdk.tracePinnedThreads=full PlainProxyConnectionTest |
60 | | - * @author danielfuchs |
| 59 | + * is always the same InetSocketAddress. Logging verbosity is increased to aid in |
| 60 | + * diagnosis of intermittent failures. |
| 61 | + * @library /test/lib |
| 62 | + * /test/jdk/java/net/httpclient/lib |
| 63 | + * @run main/othervm -Djdk.tracePinnedThreads=full |
| 64 | + * -Djdk.httpclient.HttpClient.log=headers,requests,trace |
| 65 | + * -Djdk.internal.httpclient.debug=true |
| 66 | + * PlainProxyConnectionTest |
61 | 67 | */ |
62 | 68 | public class PlainProxyConnectionTest { |
63 | 69 |
|
| 70 | + // Increase logging verbosity to troubleshoot intermittent failures |
| 71 | + static { |
| 72 | + HttpServerAdapters.enableServerLogging(); |
| 73 | + } |
| 74 | + |
64 | 75 | static final String RESPONSE = "<html><body><p>Hello World!</body></html>"; |
65 | | - static final String PATH = "/foo/"; |
| 76 | + |
| 77 | + // Adding some salt to the path to avoid other parallel running tests mistakenly connect to our test server |
| 78 | + private static final String PATH = String.format( |
| 79 | + "/%s-%d", PlainProxyConnectionTest.class.getSimpleName(), PlainProxyConnectionTest.class.hashCode()); |
| 80 | + |
66 | 81 | static final ConcurrentLinkedQueue<InetSocketAddress> connections = new ConcurrentLinkedQueue<>(); |
67 | 82 | private static final AtomicInteger IDS = new AtomicInteger(); |
68 | 83 |
|
|
0 commit comments