1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.testsuite.transport.socket;
17
18 import io.netty.channel.socket.InternetProtocolFamily;
19 import io.netty.util.internal.PlatformDependent;
20 import io.netty.util.internal.SuppressJava6Requirement;
21 import org.junit.jupiter.api.BeforeAll;
22 import org.opentest4j.TestAbortedException;
23
24 import java.io.IOException;
25 import java.net.StandardProtocolFamily;
26 import java.nio.channels.Channel;
27 import java.nio.channels.spi.SelectorProvider;
28
29 public class DatagramUnicastIPv6Test extends DatagramUnicastInetTest {
30
31 @SuppressJava6Requirement(reason = "Guarded by java version check")
32 @BeforeAll
33 public static void assumeIpv6Supported() {
34 try {
35 if (PlatformDependent.javaVersion() < 7) {
36 throw new UnsupportedOperationException();
37 }
38 Channel channel = SelectorProvider.provider().openDatagramChannel(StandardProtocolFamily.INET6);
39 channel.close();
40 } catch (UnsupportedOperationException e) {
41 throw new TestAbortedException("IPv6 not supported", e);
42 } catch (IOException ignore) {
43
44 }
45 }
46 @Override
47 protected InternetProtocolFamily internetProtocolFamily() {
48 return InternetProtocolFamily.IPv6;
49 }
50 }