Package freenet.io

Examples of freenet.io.Inet6AddressMatcher


* @version $Id: Inet6AddressMatcherTest.java 10490 2006-09-20 00:07:46Z toad $
*/
public class Inet6AddressMatcherTest extends TestCase {

  public void test() throws Exception {
    Inet6AddressMatcher matcher = new Inet6AddressMatcher("0:0:0:0:0:0:0:0/0");
    assertEquals(true, matcher.matches(InetAddress.getByName("fe80:0:0:0:203:dff:fe22:420f")));

    matcher = new Inet6AddressMatcher("fe80:0:0:0:203:dff:fe22:420f/64");
    assertEquals(true, matcher.matches(InetAddress.getByName("fe80:0:0:0:203:dff:fe22:420f")));
    assertEquals(true, matcher.matches(InetAddress.getByName("fe80:0:0:0:0203:0dff:fe22:420f")));
    assertEquals(true, matcher.matches(InetAddress.getByName("fe80:0:0:0:0204:0dff:fe22:420f")));
    assertEquals(false, matcher.matches(InetAddress.getByName("fe81:0:0:0:0203:0dff:fe22:420f")));
    assertEquals(false, matcher.matches(InetAddress.getByName("0:0:0:0:0:0:0:1")));
    assertEquals(true, matcher.matches(InetAddress.getByName("fe80:0:0:0:0:0:0:1")));

    matcher = new Inet6AddressMatcher("fe80:0:0:0:203:dff:fe22:420f/ffff:ffff:ffff:ffff:0:0:0:0");
    assertEquals(true, matcher.matches(InetAddress.getByName("fe80:0:0:0:203:dff:fe22:420f")));
    assertEquals(true, matcher.matches(InetAddress.getByName("fe80:0:0:0:0203:0dff:fe22:420f")));
    assertEquals(true, matcher.matches(InetAddress.getByName("fe80:0:0:0:0204:0dff:fe22:420f")));
    assertEquals(false, matcher.matches(InetAddress.getByName("fe81:0:0:0:0203:0dff:fe22:420f")));
    assertEquals(false, matcher.matches(InetAddress.getByName("0:0:0:0:0:0:0:1")));
    assertEquals(true, matcher.matches(InetAddress.getByName("fe80:0:0:0:0:0:0:1")));

    matcher = new Inet6AddressMatcher("fe80:0:0:0:203:dff:fe22:420f/128");
    assertEquals(true, matcher.matches(InetAddress.getByName("fe80:0:0:0:203:dff:fe22:420f")));
    assertEquals(true, matcher.matches(InetAddress.getByName("fe80:0:0:0:0203:0dff:fe22:420f")));
    assertEquals(false, matcher.matches(InetAddress.getByName("fe80:0:0:0:0204:0dff:fe22:420f")));
    assertEquals(false, matcher.matches(InetAddress.getByName("fe81:0:0:0:0203:0dff:fe22:420f")));
    assertEquals(false, matcher.matches(InetAddress.getByName("0:0:0:0:0:0:0:1")));
    assertEquals(false, matcher.matches(InetAddress.getByName("fe80:0:0:0:0:0:0:1")));
  }
View Full Code Here

TOP

Related Classes of freenet.io.Inet6AddressMatcher

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.