use of java.nio.channels.MembershipKey in project j2objc by google.
the class DatagramChannelMulticastTest method test_block_null.
public void test_block_null() throws Exception {
if (!supportsMulticast) {
return;
}
DatagramChannel dc = createReceiverChannel();
MembershipKey membershipKey = dc.join(GOOD_MULTICAST_IPv4, ipv4NetworkInterface);
try {
membershipKey.block(null);
fail();
} catch (NullPointerException expected) {
}
dc.close();
}
use of java.nio.channels.MembershipKey in project j2objc by google.
the class DatagramChannelMulticastTest method test_join_canMixTypesOnDifferentInterfaces.
/**
* Confirms that the scope of each membership is network interface-level.
*/
public void test_join_canMixTypesOnDifferentInterfaces() throws Exception {
if (!supportsMulticast) {
return;
}
DatagramChannel dc = DatagramChannel.open();
MembershipKey membershipKey1 = dc.join(GOOD_MULTICAST_IPv4, ipv4NetworkInterface);
MembershipKey membershipKey2 = dc.join(GOOD_MULTICAST_IPv4, loopbackInterface, UNICAST_IPv4_1);
assertNotSame(membershipKey1, membershipKey2);
dc.close();
}
use of java.nio.channels.MembershipKey in project JGroups by belaban.
the class MulticastTest method testDatagramChannel.
protected static void testDatagramChannel() throws IOException {
NetworkInterface ni = NetworkInterface.getByInetAddress(InetAddress.getLocalHost());
DatagramChannel dc = DatagramChannel.open(StandardProtocolFamily.INET).setOption(StandardSocketOptions.SO_REUSEADDR, true).bind(new InetSocketAddress(PORT)).setOption(StandardSocketOptions.IP_MULTICAST_IF, ni);
MembershipKey key = dc.join(group, ni);
System.out.println("key = " + key);
}
use of java.nio.channels.MembershipKey in project j2objc by google.
the class DatagramChannelMulticastTest method test_unblock_mixedAddressTypes_IPv6.
public void test_unblock_mixedAddressTypes_IPv6() throws Exception {
if (!supportsMulticast) {
return;
}
DatagramChannel dc = createReceiverChannel();
MembershipKey membershipKey = dc.join(GOOD_MULTICAST_IPv6, ipv6NetworkInterface);
try {
membershipKey.unblock(UNICAST_IPv4_1);
fail();
} catch (IllegalStateException expected) {
// Either of these exceptions are fine
} catch (IllegalArgumentException expected) {
// Either of these exceptions are fine
}
dc.close();
}
use of java.nio.channels.MembershipKey in project j2objc by google.
the class DatagramChannelMulticastTest method test_block_mixedAddressTypes_IPv6.
public void test_block_mixedAddressTypes_IPv6() throws Exception {
if (!supportsMulticast) {
return;
}
DatagramChannel dc = createReceiverChannel();
MembershipKey membershipKey = dc.join(GOOD_MULTICAST_IPv6, ipv6NetworkInterface);
try {
membershipKey.block(UNICAST_IPv4_1);
fail();
} catch (IllegalArgumentException expected) {
}
dc.close();
}
Aggregations