use of java.nio.channels.DatagramChannel in project j2objc by google.
the class DatagramChannelMulticastTest method test_open.
public void test_open() throws IOException {
DatagramChannel dc = DatagramChannel.open();
// Unlike MulticastSocket, DatagramChannel has SO_REUSEADDR set to false by default.
assertFalse(dc.getOption(StandardSocketOptions.SO_REUSEADDR));
assertNull(dc.getLocalAddress());
assertTrue(dc.isOpen());
assertFalse(dc.isConnected());
}
use of java.nio.channels.DatagramChannel in project j2objc by google.
the class DatagramChannelMulticastTest method test_block_wildcardAddress.
public void test_block_wildcardAddress() throws Exception {
if (!supportsMulticast) {
return;
}
DatagramChannel dc = createReceiverChannel();
MembershipKey membershipKey = dc.join(GOOD_MULTICAST_IPv4, ipv4NetworkInterface);
try {
membershipKey.block(WILDCARD_IPv4);
fail();
} catch (IllegalArgumentException expected) {
}
dc.close();
}
use of java.nio.channels.DatagramChannel in project j2objc by google.
the class DatagramChannelMulticastTest method test_joinSourceSpecific_afterClose.
public void test_joinSourceSpecific_afterClose() throws Exception {
if (!supportsMulticast) {
return;
}
DatagramChannel dc = createReceiverChannel();
dc.close();
try {
dc.join(GOOD_MULTICAST_IPv4, ipv4NetworkInterface, UNICAST_IPv4_1);
fail();
} catch (ClosedChannelException expected) {
}
}
use of java.nio.channels.DatagramChannel in project j2objc by google.
the class DatagramChannelMulticastTest method test_joinSourceSpecific_nonMulticastGroupAddress_IPv6.
public void test_joinSourceSpecific_nonMulticastGroupAddress_IPv6() throws Exception {
if (!supportsMulticast) {
return;
}
DatagramChannel dc = createReceiverChannel();
try {
dc.join(UNICAST_IPv6_1, ipv6NetworkInterface, UNICAST_IPv6_1);
fail();
} catch (IllegalArgumentException expected) {
}
dc.close();
}
use of java.nio.channels.DatagramChannel in project j2objc by google.
the class DatagramChannelMulticastTest method test_joinSourceSpecific_nonMulticastGroupAddress_IPv4.
public void test_joinSourceSpecific_nonMulticastGroupAddress_IPv4() throws Exception {
if (!supportsMulticast) {
return;
}
DatagramChannel dc = createReceiverChannel();
try {
dc.join(UNICAST_IPv4_1, ipv4NetworkInterface, UNICAST_IPv4_1);
fail();
} catch (IllegalArgumentException expected) {
}
dc.close();
}
Aggregations