Code example for InetSocketAddress

Methods: equals

0
        } catch (IllegalArgumentException  expected) {
        } 
    } 
 
    public void test_equals() throws Exception { 
        InetSocketAddress isa1 = new InetSocketAddress(1);
        InetSocketAddress isa2 = new InetSocketAddress(2);
        assertFalse(isa1.equals(isa2));
        InetSocketAddress isa3 = new InetSocketAddress(1);
        assertTrue(isa1.equals(isa3));
 
        InetAddress localhost = InetAddress.getByName("localhost");
        isa1 = new InetSocketAddress(localhost.getHostName(), 80);
        isa2 = new InetSocketAddress(localhost.getHostAddress(), 80);
        assertTrue(isa1.equals(isa2));
    } 
 
    public void test_getAddress() throws Exception { 
        String[] validIPAddresses = {
            "::1.2.3.4", "::", "::", "1::0", "1::", "::1", 
            "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF",