equal
deleted
inserted
replaced
40 * Check that all supported options can actually be set and got |
40 * Check that all supported options can actually be set and got |
41 */ |
41 */ |
42 public class SocketOptions { |
42 public class SocketOptions { |
43 |
43 |
44 public static void main(String args[]) throws Exception { |
44 public static void main(String args[]) throws Exception { |
|
45 if (!supported()) { |
|
46 System.out.println("Unix domain channels not supported"); |
|
47 return; |
|
48 } |
45 test(ServerSocketChannel.open(StandardProtocolFamily.UNIX)); |
49 test(ServerSocketChannel.open(StandardProtocolFamily.UNIX)); |
46 test(SocketChannel.open(StandardProtocolFamily.UNIX)); |
50 test(SocketChannel.open(StandardProtocolFamily.UNIX)); |
|
51 } |
|
52 |
|
53 static boolean supported() { |
|
54 try { |
|
55 SocketChannel.open(StandardProtocolFamily.UNIX); |
|
56 } catch (UnsupportedAddressTypeException e) { |
|
57 return false; |
|
58 } catch (Exception e) { |
|
59 return true; // continue test to see what problem is |
|
60 } |
|
61 return true; |
47 } |
62 } |
48 |
63 |
49 @SuppressWarnings("unchecked") |
64 @SuppressWarnings("unchecked") |
50 public static void test(NetworkChannel chan) throws IOException { |
65 public static void test(NetworkChannel chan) throws IOException { |
51 System.out.println("Checking: " + chan.getClass()); |
66 System.out.println("Checking: " + chan.getClass()); |