if (interf == null) {
throw new NullPointerException("null interface");
}
if (!group.isMulticastAddress()) {
throw new UnsupportedAddressTypeException();
}
if (protocolFamily == StandardProtocolFamily.INET) {
if (!((group instanceof Inet4Address) ||
((group instanceof Inet6Address) &&
((Inet6Address) group).isIPv4CompatibleAddress()))) {
throw new UnsupportedAddressTypeException();
}
} else if (protocolFamily == StandardProtocolFamily.INET6) {
if (!(group instanceof Inet6Address)) {
throw new UnsupportedAddressTypeException();
}
}
InetSocketAddress mcastaddr = new InetSocketAddress(group, 0);
MembershipKeyImpl newKey = new MembershipKeyImpl(mcastaddr, interf);