64 public SocketChannel openSocketChannel(ProtocolFamily family) throws IOException { |
64 public SocketChannel openSocketChannel(ProtocolFamily family) throws IOException { |
65 // TODO: This doesn't exclusively implement the given family |
65 // TODO: This doesn't exclusively implement the given family |
66 if (family == StandardProtocolFamily.INET || family == StandardProtocolFamily.INET6) { |
66 if (family == StandardProtocolFamily.INET || family == StandardProtocolFamily.INET6) { |
67 throw new UnsupportedOperationException("This will be supported, but is not implemented yet"); |
67 throw new UnsupportedOperationException("This will be supported, but is not implemented yet"); |
68 //return new InetSocketChannelImpl(this); |
68 //return new InetSocketChannelImpl(this); |
69 } else if (family == StandardProtocolFamily.UNIX) { |
69 } else if (family == StandardProtocolFamily.UNIX && Net.isUnixDomainSupported()) { |
70 return new UnixDomainSocketChannelImpl(this, Net.unixDomainSocket(), false); |
70 return new UnixDomainSocketChannelImpl(this, Net.unixDomainSocket(), false); |
71 } else |
71 } else |
72 throw new UnsupportedAddressTypeException(); |
72 throw new UnsupportedAddressTypeException(); |
73 } |
73 } |
74 |
74 |
75 public ServerSocketChannel openServerSocketChannel(ProtocolFamily family) throws IOException { |
75 public ServerSocketChannel openServerSocketChannel(ProtocolFamily family) throws IOException { |
76 // TODO: This doesn't exclusively implement the given family |
76 // TODO: This doesn't exclusively implement the given family |
77 if (family == StandardProtocolFamily.INET || family == StandardProtocolFamily.INET6) { |
77 if (family == StandardProtocolFamily.INET || family == StandardProtocolFamily.INET6) { |
78 throw new UnsupportedOperationException("This will be supported, but is not implemented yet"); |
78 throw new UnsupportedOperationException("This will be supported, but is not implemented yet"); |
79 //return new InetServerSocketChannelImpl(this); |
79 //return new InetServerSocketChannelImpl(this); |
80 } else if (family == StandardProtocolFamily.UNIX) { |
80 } else if (family == StandardProtocolFamily.UNIX && Net.isUnixDomainSupported()) { |
81 return new UnixDomainServerSocketChannelImpl(this); |
81 return new UnixDomainServerSocketChannelImpl(this); |
82 } else |
82 } else |
83 throw new UnsupportedAddressTypeException(); |
83 throw new UnsupportedAddressTypeException(); |
84 } |
84 } |
85 } |
85 } |