Search in sources :

Example 1 with Ip4AddressMatcher

use of com.hazelcast.util.AddressUtil.Ip4AddressMatcher in project hazelcast by hazelcast.

the class AddressUtilTest method testAddressMatcher.

@Test
public void testAddressMatcher() {
    AddressMatcher address;
    address = AddressUtil.getAddressMatcher("fe80::62c5:*:fe05:480a%en0");
    assertTrue(address.isIPv6());
    assertEquals("fe80:0:0:0:62c5:*:fe05:480a", address.getAddress());
    address = AddressUtil.getAddressMatcher("192.168.1.1");
    assertTrue(address instanceof Ip4AddressMatcher);
    assertEquals("192.168.1.1", address.getAddress());
    address = AddressUtil.getAddressMatcher("::ffff:192.0.2.128");
    assertTrue(address.isIPv4());
    assertEquals("192.0.2.128", address.getAddress());
}
Also used : Ip4AddressMatcher(com.hazelcast.util.AddressUtil.Ip4AddressMatcher) Ip4AddressMatcher(com.hazelcast.util.AddressUtil.Ip4AddressMatcher) AddressMatcher(com.hazelcast.util.AddressUtil.AddressMatcher) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

QuickTest (com.hazelcast.test.annotation.QuickTest)1 AddressMatcher (com.hazelcast.util.AddressUtil.AddressMatcher)1 Ip4AddressMatcher (com.hazelcast.util.AddressUtil.Ip4AddressMatcher)1 Test (org.junit.Test)1