Examples of DHCPOption


Examples of org.dhcp4java.DHCPOption

   
    assertEquals(opt.getValueAsInetAddr(), InetAddress.getByName("252.10.224.3"));
  }
  @Test
  public void testNewOptionAsInetAddressGetValueAsInetAddressSingle() throws Exception {
    DHCPOption opt = DHCPOption.newOptionAsInetAddress(DHO_WWW_SERVER,
                      InetAddress.getByName("252.10.224.3"));
    assertEquals(opt.getCode(), DHO_WWW_SERVER);
    assertTrue(Arrays.equals(opt.getValue(), HexUtils.hexToBytes("FC0AE003")));
   
    InetAddress[] iadrs = opt.getValueAsInetAddrs();
    assertNotNull(iadrs);
    assertEquals(1, iadrs.length);
    assertEquals(InetAddress.getByName("252.10.224.3"), iadrs[0]);
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

  public void testNewOptionAsInetAddressBad() throws Exception {
    DHCPOption.newOptionAsInetAddress(DHO_DHCP_LEASE_TIME, InetAddress.getByName("252.10.224.3"));
  }
  @Test (expected=IllegalArgumentException.class)
  public void testGetValueAsInetAddressBad() {
    DHCPOption opt = new DHCPOption(DHO_DHCP_LEASE_TIME, new byte[0]);
    opt.getValueAsInetAddr();
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

    DHCPOption opt = new DHCPOption(DHO_DHCP_LEASE_TIME, new byte[0]);
    opt.getValueAsInetAddr();
  }
  @Test (expected=IllegalStateException.class)
  public void testGetValueAsInetAddressIllegalState() {
    DHCPOption opt = new DHCPOption(DHO_SUBNET_MASK, null);
    opt.getValueAsInetAddr();
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

    DHCPOption opt = new DHCPOption(DHO_SUBNET_MASK, null);
    opt.getValueAsInetAddr();
  }
  @Test (expected=DHCPBadPacketException.class)
  public void testGetValueAsInetAddressBadSize3() {
    DHCPOption opt = new DHCPOption(DHO_SUBNET_MASK, new byte[3]);
    opt.getValueAsInetAddr();
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

    DHCPOption opt = new DHCPOption(DHO_SUBNET_MASK, new byte[3]);
    opt.getValueAsInetAddr();
  }
  @Test (expected=DHCPBadPacketException.class)
  public void testGetValueAsInetAddressBadSize5() {
    DHCPOption opt = new DHCPOption(DHO_SUBNET_MASK, new byte[5]);
    opt.getValueAsInetAddr();
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

  public void testNewOptionAsInetAddressesGetValueAsInetAddresses() throws Exception {
    InetAddress[] iadrs = new InetAddress[3];
    iadrs[0] = InetAddress.getByName("0.0.0.0");
    iadrs[1] = InetAddress.getByName("252.10.224.3");
    iadrs[2] = InetAddress.getByName("255.255.255.255");
    DHCPOption opt = DHCPOption.newOptionAsInetAddresses(DHO_WWW_SERVER, iadrs);
    assertEquals(DHO_WWW_SERVER, opt.getCode());
    assertTrue(Arrays.equals(HexUtils.hexToBytes("00000000FC0AE003FFFFFFFF"), opt.getValue()));
   
    assertTrue(Arrays.equals(iadrs, opt.getValueAsInetAddrs()));
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

    iadrs[0] = InetAddress.getByName("0.0.0.0");
    DHCPOption.newOptionAsInetAddresses(DHO_DHCP_LEASE_TIME, iadrs);
  }
  @Test (expected=IllegalArgumentException.class)
  public void testGetValueAsInetAddressesBad() {
    DHCPOption opt = new DHCPOption(DHO_DHCP_LEASE_TIME, new byte[0]);
    opt.getValueAsInetAddrs();
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

    DHCPOption opt = new DHCPOption(DHO_DHCP_LEASE_TIME, new byte[0]);
    opt.getValueAsInetAddrs();
  }
  @Test (expected=IllegalStateException.class)
  public void testGetValueAsInetAddressesIllegalState() {
    DHCPOption opt = new DHCPOption(DHO_WWW_SERVER, null);
    opt.getValueAsInetAddrs();
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

    DHCPOption opt = new DHCPOption(DHO_WWW_SERVER, null);
    opt.getValueAsInetAddrs();
  }
  @Test (expected=DHCPBadPacketException.class)
  public void testGetValueAsInetAddressesBadSize3() {
    DHCPOption opt = new DHCPOption(DHO_WWW_SERVER, new byte[3]);
    opt.getValueAsInetAddrs();
  }
View Full Code Here

Examples of org.dhcp4java.DHCPOption

    DHCPOption opt = new DHCPOption(DHO_WWW_SERVER, new byte[3]);
    opt.getValueAsInetAddrs();
  }
  @Test (expected=DHCPBadPacketException.class)
  public void testGetValueAsInetAddressesBadSize9() {
    DHCPOption opt = new DHCPOption(DHO_WWW_SERVER, new byte[9]);
    opt.getValueAsInetAddrs();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.