diff --git a/test/jdk/java/net/Socket/B8312065.java b/test/jdk/java/net/Socket/B8312065.java index 118792eada3..69194ddfa01 100644 --- a/test/jdk/java/net/Socket/B8312065.java +++ b/test/jdk/java/net/Socket/B8312065.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Alibaba Group Holding Limited. All Rights Reserved. + * Copyright (c) 2023, 2025, Alibaba Group Holding Limited. 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 @@ -26,6 +26,8 @@ * @bug 8312065 * @summary Socket.connect does not timeout as expected when profiling (i.e. keep receiving signal) * @requires (os.family != "windows") + * @library /test/lib + * @build jtreg.SkippedException * @compile NativeThread.java * @run main/othervm/native/timeout=120 -Djdk.net.usePlainSocketImpl B8312065 */ @@ -37,6 +39,8 @@ import java.net.SocketTimeoutException; import java.util.concurrent.TimeUnit; +import jtreg.SkippedException; + public class B8312065 { public static void main(String[] args) throws Exception { System.loadLibrary("NativeThread"); @@ -83,6 +87,8 @@ public static void main(String[] args) throws Exception { System.out.println("Test FAILED: duration " + duration + " ms, expected >= " + timeoutMillis + " ms"); System.exit(1); } + } catch (java.net.ConnectException e) { + throw new SkippedException("Network setup issue, skip this test", e); } } }