Package org.dhcp4java

Examples of org.dhcp4java.DHCPOption


    DHCPOption opt = new DHCPOption(DHO_PATH_MTU_PLATEAU_TABLE, new byte[1]);
    opt.getValueAsShorts();
  }
  @Test (expected=DHCPBadPacketException.class)
  public void testGetValueAsShortsBadSize5() {
    DHCPOption opt = new DHCPOption(DHO_PATH_MTU_PLATEAU_TABLE, new byte[5]);
    opt.getValueAsShorts();
  }
View Full Code Here


  public void testNewOptionAsShorts() {
    short[] shorts = new short[3];
    shorts[0] = (short) 1500;
    shorts[1] = (short) 0;
    shorts[2] = (short) -1;
    DHCPOption opt = DHCPOption.newOptionAsShorts(DHO_PATH_MTU_PLATEAU_TABLE, shorts);
    DHCPOption opt2 = new DHCPOption(DHO_PATH_MTU_PLATEAU_TABLE, HexUtils.hexToBytes("05DC0000FFFF"));
    assertEquals(opt2, opt);
    assertTrue(Arrays.equals(opt.getValue(), HexUtils.hexToBytes("05DC0000FFFF")));
    assertTrue(Arrays.equals(shorts, opt.getValueAsShorts()));
  }
View Full Code Here

 
 
  // Int
  @Test
  public void testNewOptionAsIntGetValueAsInt() {
    DHCPOption opt = DHCPOption.newOptionAsInt(DHO_DHCP_LEASE_TIME, 0x01FE02FC);
    assertEquals(opt.getCode(), DHO_DHCP_LEASE_TIME);
    assertTrue(Arrays.equals(opt.getValue(), HexUtils.hexToBytes("01FE02FC")));
   
    assertEquals(opt.getValueAsInt(), 0x01FE02FC);
  }
View Full Code Here

  public void testNewOptionAsIntBad() {
    DHCPOption.newOptionAsInt(DHO_SUBNET_MASK, 0);
  }
  @Test (expected=IllegalArgumentException.class)
  public void testGetValueAsIntBad() {
    DHCPOption opt = new DHCPOption(DHO_SUBNET_MASK, new byte[0]);
    opt.getValueAsInt();
  }
View Full Code Here

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

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

TOP

Related Classes of org.dhcp4java.DHCPOption

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.