Code example for MulticastSocket

Methods: getNetworkInterface, setInterface, setNetworkInterface

0
                assertEquals("getNetworkInterface did not return network interface set by second setNetworkInterface call", 
                             networkInterface2, mss.getNetworkInterface());
            } 
 
            groupPort = Support_PortManager.getNextPortForUDP();
            mss = new MulticastSocket(groupPort);
            if (IPV6networkInterface1 != null) {
                mss.setNetworkInterface(IPV6networkInterface1);
                assertEquals("getNetworkInterface did not return interface set by setNeworkInterface", 
                             IPV6networkInterface1,
                             mss.getNetworkInterface());
            } 
 
            // validate that we get the expected response when we set via 
            // setInterface 
            groupPort = Support_PortManager.getNextPortForUDP();
            mss = new MulticastSocket(groupPort);
            Enumeration addresses = networkInterface1.getInetAddresses();
            if (addresses.hasMoreElements()) {
                firstAddress = (InetAddress) addresses.nextElement();
                mss.setInterface(firstAddress);