Code example for MulticastSocket

Methods: close, getLocalPort

0
 
	/** 
	 * @tests java.net.MulticastSocket#MulticastSocket(int) 
	 */ 
	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();
	} 
 
	/**