Code example for MulticastSocket

Methods: close, getLocalPort

0
 
    public void test_ConstructorI() throws IOException { 
        MulticastSocket orig = new MulticastSocket();
        int port = orig.getLocalPort();
        orig.close();
        MulticastSocket dup = null;
        try { 
            dup = new MulticastSocket(port);
            // regression test for Harmony-1162 
            assertTrue(dup.getReuseAddress());
        } catch (IOException e) {
            fail("duplicate binding not allowed: " + e);
        } 
        if (dup != null) {
            dup.close();
        } 
    } 
 
    public void test_getInterface() throws Exception { 
        int groupPort = Support_PortManager.getNextPortForUDP();