use of java.nio.channels.DatagramChannel in project j2objc by google.
the class DatagramChannelMulticastTest method check_dropAnySource_twice.
private void check_dropAnySource_twice(InetAddress group, NetworkInterface networkInterface) throws Exception {
if (!supportsMulticast) {
return;
}
DatagramChannel dc = createReceiverChannel();
MembershipKey membershipKey = dc.join(group, networkInterface);
assertTrue(membershipKey.isValid());
membershipKey.drop();
assertFalse(membershipKey.isValid());
// Try to leave a group we are no longer a member of - should do nothing.
membershipKey.drop();
dc.close();
}
use of java.nio.channels.DatagramChannel in project j2objc by google.
the class DatagramChannelMulticastTest method test_block_mixedAddressTypes_IPv4.
public void test_block_mixedAddressTypes_IPv4() throws Exception {
if (!supportsMulticast) {
return;
}
DatagramChannel dc = createReceiverChannel();
MembershipKey membershipKey = dc.join(GOOD_MULTICAST_IPv4, ipv4NetworkInterface);
try {
membershipKey.block(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_nonUniicastSourceAddress_IPv6.
public void test_joinSourceSpecific_nonUniicastSourceAddress_IPv6() throws Exception {
if (!supportsMulticast) {
return;
}
DatagramChannel dc = createReceiverChannel();
try {
dc.join(GOOD_MULTICAST_IPv6, ipv6NetworkInterface, BAD_MULTICAST_IPv6);
fail();
} catch (IllegalArgumentException expected) {
}
dc.close();
}
use of java.nio.channels.DatagramChannel in project j2objc by google.
the class DatagramChannelMulticastTest method test_unblock_null.
public void test_unblock_null() throws Exception {
if (!supportsMulticast) {
return;
}
DatagramChannel dc = createReceiverChannel();
MembershipKey membershipKey = dc.join(GOOD_MULTICAST_IPv4, ipv4NetworkInterface);
membershipKey.block(UNICAST_IPv4_1);
try {
membershipKey.unblock(null);
fail();
} catch (IllegalStateException expected) {
// Either of these exceptions are fine
} catch (NullPointerException expected) {
// Either of these exception are fine
}
dc.close();
}
use of java.nio.channels.DatagramChannel in project j2objc by google.
the class DatagramChannelMulticastTest method test_joinAnySource_nonMulticastGroupAddress_IPv4.
public void test_joinAnySource_nonMulticastGroupAddress_IPv4() throws Exception {
if (!supportsMulticast) {
return;
}
DatagramChannel dc = createReceiverChannel();
try {
dc.join(UNICAST_IPv4_1, ipv4NetworkInterface);
fail();
} catch (IllegalArgumentException expected) {
}
dc.close();
}
Aggregations