--- a/test/jdk/java/nio/channels/unixdomain/Basic.java Wed Nov 13 11:37:09 2019 +0000
+++ b/test/jdk/java/nio/channels/unixdomain/Basic.java Thu Nov 14 08:27:28 2019 +0000
@@ -45,6 +45,7 @@
public static void main(String args[]) throws Exception {
if (args.length != 3)
usage();
+
if (!supported()) {
System.out.println("Unix domain channels not supported");
return;
--- a/test/jdk/java/nio/channels/unixdomain/SocketOptions.java Wed Nov 13 11:37:09 2019 +0000
+++ b/test/jdk/java/nio/channels/unixdomain/SocketOptions.java Thu Nov 14 08:27:28 2019 +0000
@@ -42,10 +42,25 @@
public class SocketOptions {
public static void main(String args[]) throws Exception {
+ if (!supported()) {
+ System.out.println("Unix domain channels not supported");
+ return;
+ }
test(ServerSocketChannel.open(StandardProtocolFamily.UNIX));
test(SocketChannel.open(StandardProtocolFamily.UNIX));
}
+ static boolean supported() {
+ try {
+ SocketChannel.open(StandardProtocolFamily.UNIX);
+ } catch (UnsupportedAddressTypeException e) {
+ return false;
+ } catch (Exception e) {
+ return true; // continue test to see what problem is
+ }
+ return true;
+ }
+
@SuppressWarnings("unchecked")
public static void test(NetworkChannel chan) throws IOException {
System.out.println("Checking: " + chan.getClass());