Code example for NetworkInterface

Methods: getInetAddresses

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