Package java.net

Examples of java.net.Inet4Address


        transformer.perform(null);
    }

    @Test
    public void canTransformAnAddress() throws UnknownHostException {
        final Inet4Address got = transformer.perform(0x7f000001L);
        Assert.assertEquals(InetAddress.getByName("127.0.0.1"), got);
    }
View Full Code Here


        Assert.assertEquals(InetAddress.getByName("127.0.0.1"), got);
    }

    @Test
    public void canTransformNegativeBytes() throws UnknownHostException {
        final Inet4Address got = transformer.perform(0xffffffffL);
        Assert.assertEquals(InetAddress.getByName("255.255.255.255"), got);
    }
View Full Code Here

        transformer.perform(null);
    }
   
    @Test
    public void canTransformAnAddress() throws UnknownHostException {
        final Inet4Address address = (Inet4Address) InetAddress.getByName("127.0.0.1");
        long got = transformer.perform(address);
        Assert.assertEquals(0x7f000001L, got);
    }
View Full Code Here

        long got = transformer.perform(address);
        Assert.assertEquals(0x7f000001L, got);
    }
    @Test
    public void canTransformNegativeBytes() throws UnknownHostException {
        final Inet4Address address = (Inet4Address) InetAddress.getByName("255.255.255.255");
        long got = transformer.perform(address);
        Assert.assertEquals(0xffffffffL, got);
    }
View Full Code Here

  }

  @Test
  public void testCompareEqual() throws UnknownHostException {

    final Inet4Address ip1 = ip("1.1.1.1");
    final Inet4Address ip2 = ip("1.1.1.1");
    Assert.assertEquals(0, COMPARATOR.compare(ip1, ip2));
  }
View Full Code Here

  }

  @Test
  public void testCompareGreater() throws UnknownHostException {

    final Inet4Address ip1 = ip("250.250.250.250");
    final Inet4Address ip2 = ip("100.100.100.100");
    Assert.assertTrue(COMPARATOR.compare(ip1, ip2) > 0);
  }
View Full Code Here

  }

  @Test
  public void testCompareLesser() throws UnknownHostException {

    final Inet4Address ip1 = ip("1.1.1.1");
    final Inet4Address ip2 = ip("100.100.100.100");
    Assert.assertTrue(COMPARATOR.compare(ip1, ip2) < 0);
  }
View Full Code Here

      false);

  @Test
  public void testCompareEqual4() throws UnknownHostException {

    final Inet4Address ip1 = Inet4AddressComparatorTest.ip("1.1.1.1");
    final Inet4Address ip2 = Inet4AddressComparatorTest.ip("1.1.1.1");
    Assert.assertEquals(0, V4_LESS.compare(ip1, ip2));
  }
View Full Code Here

  }

  @Test
  public void testCompareGreater4() throws UnknownHostException {

    final Inet4Address ip1 = Inet4AddressComparatorTest
        .ip("250.250.250.250");
    final Inet4Address ip2 = Inet4AddressComparatorTest
        .ip("100.100.100.100");
    Assert.assertTrue(V4_LESS.compare(ip1, ip2) > 0);
  }
View Full Code Here

  }

  @Test
  public void testCompareLesser4() throws UnknownHostException {

    final Inet4Address ip1 = Inet4AddressComparatorTest.ip("1.1.1.1");
    final Inet4Address ip2 = Inet4AddressComparatorTest
        .ip("100.100.100.100");
    Assert.assertTrue(V4_LESS.compare(ip1, ip2) < 0);
  }
View Full Code Here

TOP

Related Classes of java.net.Inet4Address

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.