8318788: java/net/Socks/SocksSocketProxySelectorTest.java fails on machines with no IPv6 link-local addresses
Reviewed-by: jpai, dfuchs, mbaesken
This commit is contained in:
parent
37c40a11a7
commit
970cd20204
@ -21,12 +21,14 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.Assumptions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.Inet6Address;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.NetworkInterface;
|
import java.net.NetworkInterface;
|
||||||
import java.net.Proxy;
|
import java.net.Proxy;
|
||||||
@ -76,6 +78,7 @@ public class SocksSocketProxySelectorTest {
|
|||||||
return NetworkInterface.networkInterfaces()
|
return NetworkInterface.networkInterfaces()
|
||||||
.flatMap(NetworkInterface::inetAddresses)
|
.flatMap(NetworkInterface::inetAddresses)
|
||||||
.filter(InetAddress::isLinkLocalAddress)
|
.filter(InetAddress::isLinkLocalAddress)
|
||||||
|
.filter(Inet6Address.class::isInstance)
|
||||||
.map(InetAddress::getHostAddress);
|
.map(InetAddress::getHostAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,9 +138,12 @@ public class SocksSocketProxySelectorTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@Test
|
||||||
@MethodSource("linkLocalIpv6Literals")
|
public void testLinkLocalIpv6Literals() throws Exception {
|
||||||
public void testLinkLocalIpv6Literals(String host) throws Exception {
|
String host = linkLocalIpv6Literals()
|
||||||
|
.findFirst()
|
||||||
|
.orElseGet(() -> Assumptions.abort("No IPv6 link-local addresses found"));
|
||||||
|
System.err.println(host);
|
||||||
try (Socket s1 = new Socket(host, 80)) {
|
try (Socket s1 = new Socket(host, 80)) {
|
||||||
fail("IOException was expected to be thrown, but wasn't");
|
fail("IOException was expected to be thrown, but wasn't");
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
|
Loading…
Reference in New Issue
Block a user