Java Code Examples for java.net.InterfaceAddress#equals()

The following examples show how to use java.net.InterfaceAddress#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Equals.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    InterfaceAddress ia1;
    InterfaceAddress ia2;
    InetAddress loopbackAddr = InetAddress.getLoopbackAddress();
    InetAddress broadcast1 = null;
    InetAddress broadcast2 = null;

    try {
        broadcast1 = InetAddress.getByName("255.255.255.0");
        broadcast2 = InetAddress.getByName("255.255.0.0");
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }

    ia1 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);

    compare(ia1, ia2, true);

    ia2 = createInterfaceAddress(loopbackAddr, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia2 = createInterfaceAddress((InetAddress)null, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia1 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    compare(ia1, ia2, true);

    ia1.equals(null);
}
 
Example 2
Source File: Equals.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
static void compare(InterfaceAddress ia1, InterfaceAddress ia2, boolean equal) {
    if (ia1.equals(ia2) != equal)
        throw new RuntimeException("Failed: " + ia1 + " not equals to " + ia2);

    if (ia2.equals(ia1) != equal)
        throw new RuntimeException("Failed: " + ia2 + " not equals to " + ia1);
}
 
Example 3
Source File: Equals.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    InterfaceAddress ia1;
    InterfaceAddress ia2;
    InetAddress loopbackAddr = InetAddress.getLoopbackAddress();
    InetAddress broadcast1 = null;
    InetAddress broadcast2 = null;

    try {
        broadcast1 = InetAddress.getByName("255.255.255.0");
        broadcast2 = InetAddress.getByName("255.255.0.0");
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }

    ia1 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);

    compare(ia1, ia2, true);

    ia2 = createInterfaceAddress(loopbackAddr, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia2 = createInterfaceAddress((InetAddress)null, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia1 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    compare(ia1, ia2, true);

    ia1.equals(null);
}
 
Example 4
Source File: Equals.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    InterfaceAddress ia1;
    InterfaceAddress ia2;
    InetAddress loopbackAddr = InetAddress.getLoopbackAddress();
    InetAddress broadcast1 = null;
    InetAddress broadcast2 = null;

    try {
        broadcast1 = InetAddress.getByName("255.255.255.0");
        broadcast2 = InetAddress.getByName("255.255.0.0");
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }

    ia1 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);

    compare(ia1, ia2, true);

    ia2 = createInterfaceAddress(loopbackAddr, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia2 = createInterfaceAddress((InetAddress)null, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia1 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    compare(ia1, ia2, true);

    ia1.equals(null);
}
 
Example 5
Source File: Equals.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    InterfaceAddress ia1;
    InterfaceAddress ia2;
    InetAddress loopbackAddr = InetAddress.getLoopbackAddress();
    InetAddress broadcast1 = null;
    InetAddress broadcast2 = null;

    try {
        broadcast1 = InetAddress.getByName("255.255.255.0");
        broadcast2 = InetAddress.getByName("255.255.0.0");
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }

    ia1 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);

    compare(ia1, ia2, true);

    ia2 = createInterfaceAddress(loopbackAddr, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia2 = createInterfaceAddress((InetAddress)null, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia1 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    compare(ia1, ia2, true);

    ia1.equals(null);
}
 
Example 6
Source File: Equals.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
static void compare(InterfaceAddress ia1, InterfaceAddress ia2, boolean equal) {
    if (ia1.equals(ia2) != equal)
        throw new RuntimeException("Failed: " + ia1 + " not equals to " + ia2);

    if (ia2.equals(ia1) != equal)
        throw new RuntimeException("Failed: " + ia2 + " not equals to " + ia1);
}
 
Example 7
Source File: Equals.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    InterfaceAddress ia1;
    InterfaceAddress ia2;
    InetAddress loopbackAddr = InetAddress.getLoopbackAddress();
    InetAddress broadcast1 = null;
    InetAddress broadcast2 = null;

    try {
        broadcast1 = InetAddress.getByName("255.255.255.0");
        broadcast2 = InetAddress.getByName("255.255.0.0");
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }

    ia1 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);

    compare(ia1, ia2, true);

    ia2 = createInterfaceAddress(loopbackAddr, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia2 = createInterfaceAddress((InetAddress)null, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia1 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    compare(ia1, ia2, true);

    ia1.equals(null);
}
 
Example 8
Source File: Equals.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
static void compare(InterfaceAddress ia1, InterfaceAddress ia2, boolean equal) {
    if (ia1.equals(ia2) != equal)
        throw new RuntimeException("Failed: " + ia1 + " not equals to " + ia2);

    if (ia2.equals(ia1) != equal)
        throw new RuntimeException("Failed: " + ia2 + " not equals to " + ia1);
}
 
Example 9
Source File: Equals.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    InterfaceAddress ia1;
    InterfaceAddress ia2;
    InetAddress loopbackAddr = InetAddress.getLoopbackAddress();
    InetAddress broadcast1 = null;
    InetAddress broadcast2 = null;

    try {
        broadcast1 = InetAddress.getByName("255.255.255.0");
        broadcast2 = InetAddress.getByName("255.255.0.0");
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }

    ia1 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);

    compare(ia1, ia2, true);

    ia2 = createInterfaceAddress(loopbackAddr, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia2 = createInterfaceAddress((InetAddress)null, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia1 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    compare(ia1, ia2, true);

    ia1.equals(null);
}
 
Example 10
Source File: Equals.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static void compare(InterfaceAddress ia1, InterfaceAddress ia2, boolean equal) {
    if (ia1.equals(ia2) != equal)
        throw new RuntimeException("Failed: " + ia1 + " not equals to " + ia2);

    if (ia2.equals(ia1) != equal)
        throw new RuntimeException("Failed: " + ia2 + " not equals to " + ia1);
}
 
Example 11
Source File: Equals.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
static void compare(InterfaceAddress ia1, InterfaceAddress ia2, boolean equal) {
    if (ia1.equals(ia2) != equal)
        throw new RuntimeException("Failed: " + ia1 + " not equals to " + ia2);

    if (ia2.equals(ia1) != equal)
        throw new RuntimeException("Failed: " + ia2 + " not equals to " + ia1);
}
 
Example 12
Source File: Equals.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static void compare(InterfaceAddress ia1, InterfaceAddress ia2, boolean equal) {
    if (ia1.equals(ia2) != equal)
        throw new RuntimeException("Failed: " + ia1 + " not equals to " + ia2);

    if (ia2.equals(ia1) != equal)
        throw new RuntimeException("Failed: " + ia2 + " not equals to " + ia1);
}
 
Example 13
Source File: Equals.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    InterfaceAddress ia1;
    InterfaceAddress ia2;
    InetAddress loopbackAddr = InetAddress.getLoopbackAddress();
    InetAddress broadcast1 = null;
    InetAddress broadcast2 = null;

    try {
        broadcast1 = InetAddress.getByName("255.255.255.0");
        broadcast2 = InetAddress.getByName("255.255.0.0");
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }

    ia1 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);

    compare(ia1, ia2, true);

    ia2 = createInterfaceAddress(loopbackAddr, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia2 = createInterfaceAddress((InetAddress)null, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia1 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    compare(ia1, ia2, true);

    ia1.equals(null);
}
 
Example 14
Source File: Equals.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static void compare(InterfaceAddress ia1, InterfaceAddress ia2, boolean equal) {
    if (ia1.equals(ia2) != equal)
        throw new RuntimeException("Failed: " + ia1 + " not equals to " + ia2);

    if (ia2.equals(ia1) != equal)
        throw new RuntimeException("Failed: " + ia2 + " not equals to " + ia1);
}
 
Example 15
Source File: Equals.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    InterfaceAddress ia1;
    InterfaceAddress ia2;
    InetAddress loopbackAddr = InetAddress.getLoopbackAddress();
    InetAddress broadcast1 = null;
    InetAddress broadcast2 = null;

    try {
        broadcast1 = InetAddress.getByName("255.255.255.0");
        broadcast2 = InetAddress.getByName("255.255.0.0");
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }

    ia1 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);

    compare(ia1, ia2, true);

    ia2 = createInterfaceAddress(loopbackAddr, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia2 = createInterfaceAddress((InetAddress)null, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia1 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    compare(ia1, ia2, true);

    ia1.equals(null);
}
 
Example 16
Source File: Equals.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
static void compare(InterfaceAddress ia1, InterfaceAddress ia2, boolean equal) {
    if (ia1.equals(ia2) != equal)
        throw new RuntimeException("Failed: " + ia1 + " not equals to " + ia2);

    if (ia2.equals(ia1) != equal)
        throw new RuntimeException("Failed: " + ia2 + " not equals to " + ia1);
}
 
Example 17
Source File: Equals.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    InterfaceAddress ia1;
    InterfaceAddress ia2;
    InetAddress loopbackAddr = InetAddress.getLoopbackAddress();
    InetAddress broadcast1 = null;
    InetAddress broadcast2 = null;

    try {
        broadcast1 = InetAddress.getByName("255.255.255.0");
        broadcast2 = InetAddress.getByName("255.255.0.0");
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }

    ia1 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);

    compare(ia1, ia2, true);

    ia2 = createInterfaceAddress(loopbackAddr, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia2 = createInterfaceAddress((InetAddress)null, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia1 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    compare(ia1, ia2, true);

    ia1.equals(null);
}
 
Example 18
Source File: Equals.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
static void compare(InterfaceAddress ia1, InterfaceAddress ia2, boolean equal) {
    if (ia1.equals(ia2) != equal)
        throw new RuntimeException("Failed: " + ia1 + " not equals to " + ia2);

    if (ia2.equals(ia1) != equal)
        throw new RuntimeException("Failed: " + ia2 + " not equals to " + ia1);
}
 
Example 19
Source File: Equals.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    InterfaceAddress ia1;
    InterfaceAddress ia2;
    InetAddress loopbackAddr = InetAddress.getLoopbackAddress();
    InetAddress broadcast1 = null;
    InetAddress broadcast2 = null;

    try {
        broadcast1 = InetAddress.getByName("255.255.255.0");
        broadcast2 = InetAddress.getByName("255.255.0.0");
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }

    ia1 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, (InetAddress) null, (short)45);

    compare(ia1, ia2, true);

    ia2 = createInterfaceAddress(loopbackAddr, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia2 = createInterfaceAddress((InetAddress)null, broadcast1, (short)45);
    compare(ia1, ia2, false);

    ia1 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    ia2 = createInterfaceAddress(loopbackAddr, broadcast2, (short)45);
    compare(ia1, ia2, true);

    ia1.equals(null);
}
 
Example 20
Source File: Equals.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
static void compare(InterfaceAddress ia1, InterfaceAddress ia2, boolean equal) {
    if (ia1.equals(ia2) != equal)
        throw new RuntimeException("Failed: " + ia1 + " not equals to " + ia2);

    if (ia2.equals(ia1) != equal)
        throw new RuntimeException("Failed: " + ia2 + " not equals to " + ia1);
}