Skip to content

Commit 970cd20

Browse files
committed
8318788: java/net/Socks/SocksSocketProxySelectorTest.java fails on machines with no IPv6 link-local addresses
Reviewed-by: jpai, dfuchs, mbaesken
1 parent 37c40a1 commit 970cd20

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/jdk/java/net/Socks/SocksSocketProxySelectorTest.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
* questions.
2222
*/
2323

24-
import org.junit.jupiter.api.AfterAll;
24+
import org.junit.jupiter.api.Assumptions;
2525
import org.junit.jupiter.api.BeforeAll;
26+
import org.junit.jupiter.api.Test;
2627
import org.junit.jupiter.params.ParameterizedTest;
2728
import org.junit.jupiter.params.provider.MethodSource;
2829

2930
import java.io.IOException;
31+
import java.net.Inet6Address;
3032
import java.net.InetAddress;
3133
import java.net.NetworkInterface;
3234
import java.net.Proxy;
@@ -76,6 +78,7 @@ public static Stream<String> linkLocalIpv6Literals() throws SocketException {
7678
return NetworkInterface.networkInterfaces()
7779
.flatMap(NetworkInterface::inetAddresses)
7880
.filter(InetAddress::isLinkLocalAddress)
81+
.filter(Inet6Address.class::isInstance)
7982
.map(InetAddress::getHostAddress);
8083
}
8184

@@ -135,9 +138,12 @@ public void testShortIpv6Literals(String host) throws Exception {
135138
}
136139
}
137140

138-
@ParameterizedTest
139-
@MethodSource("linkLocalIpv6Literals")
140-
public void testLinkLocalIpv6Literals(String host) throws Exception {
141+
@Test
142+
public void testLinkLocalIpv6Literals() throws Exception {
143+
String host = linkLocalIpv6Literals()
144+
.findFirst()
145+
.orElseGet(() -> Assumptions.abort("No IPv6 link-local addresses found"));
146+
System.err.println(host);
141147
try (Socket s1 = new Socket(host, 80)) {
142148
fail("IOException was expected to be thrown, but wasn't");
143149
} catch (IOException ioe) {

0 commit comments

Comments
 (0)