RFR: 7539: JDP Tests failing in VPN environments
Christoph Langer
clanger at openjdk.java.net
Fri Jan 21 14:53:10 UTC 2022
On Fri, 21 Jan 2022 14:25:16 GMT, Johannes Bechberger <duke at openjdk.java.net> wrote:
> Only run broadcasting related tests when supported.
> Tested on Mac M1 with and without VPN.
You also need to update the copyright years.
I'll test this later with my VPN.
core/tests/org.openjdk.jmc.jdp.test/src/test/java/org/openjdk/jmc/jdp/client/TestToolkit.java line 72:
> 70: }
> 71: TEST_MULTICAST_ADDRESS = tmp;
> 72: BROADCASTING_SUPPORTED = isBroadcastingSupported();
Hm, I'm wondering whether this broadcasting check should be done in the static initialization of the class... maybe not. Rather do it lazily when calling isBroadcastingSupported()? There are a few tests which don't need this...
core/tests/org.openjdk.jmc.jdp.test/src/test/java/org/openjdk/jmc/jdp/client/TestToolkit.java line 165:
> 163: int multiCastPort = 7711;
> 164: Thread thread = new Thread(() -> {
> 165: try {
you can use a try-with resources here: `try (MulticastSocket ssocket = new MulticastSocket(multiCastPort)) {` That way, the socket will also be closed in the end.
core/tests/org.openjdk.jmc.jdp.test/src/test/java/org/openjdk/jmc/jdp/client/TestToolkit.java line 178:
> 176: });
> 177: thread.start();
> 178: try {
Same here, try-with resources. The thread.interrupt() can then be done in the `finally` clause.
-------------
Changes requested by clanger (Author).
PR: https://git.openjdk.java.net/jmc/pull/369
More information about the jmc-dev
mailing list