Package org.dhcp4java

Examples of org.dhcp4java.DHCPOption


    DHCPOption opt = new DHCPOption(DHO_IP_FORWARDING, null);
    opt.getValueAsByte();
  }
  @Test (expected=DHCPBadPacketException.class)
  public void testGetValueAsByteBadSize2() {
    DHCPOption opt = new DHCPOption(DHO_IP_FORWARDING, new byte[2]);
    opt.getValueAsByte();
  }
View Full Code Here


  }
 
  // Short
  @Test
  public void testNewOptionAsShortGetValueAsShort() {
    DHCPOption opt = DHCPOption.newOptionAsShort(DHO_INTERFACE_MTU, (short)1500);
    assertEquals(opt.getCode(), DHO_INTERFACE_MTU);
    assertTrue(Arrays.equals(opt.getValue(), HexUtils.hexToBytes("05DC")));
   
    assertEquals(opt.getValueAsShort(), (short) 1500);
  }
View Full Code Here

  public void testNewOptionAsShortBad() {
    DHCPOption.newOptionAsShort(DHO_DHCP_LEASE_TIME, (short) 0);
  }
  @Test (expected=IllegalArgumentException.class)
  public void testGetValueAsShortBad() {
    DHCPOption opt = new DHCPOption(DHO_DHCP_LEASE_TIME, new byte[0]);
    opt.getValueAsShort();
  }
View Full Code Here

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

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

    DHCPOption opt = new DHCPOption(DHO_INTERFACE_MTU, new byte[3]);
    opt.getValueAsShort();
  }
  @Test (expected=DHCPBadPacketException.class)
  public void testGetValueAsShortBadSize1() {
    DHCPOption opt = new DHCPOption(DHO_INTERFACE_MTU, new byte[1]);
    opt.getValueAsShort();
  }
View Full Code Here

    opt.getValueAsShort();
  }
  // Shorts
  @Test
  public void testGetValueAsShorts() {
    DHCPOption opt = new DHCPOption(DHO_PATH_MTU_PLATEAU_TABLE, HexUtils.hexToBytes("05DC0000FFFF"));
    short[] shorts = new short[3];
    shorts[0] = (short) 1500;
    shorts[1] = (short) 0;
    shorts[2] = (short) -1;
    assertEquals(DHO_PATH_MTU_PLATEAU_TABLE, opt.getCode());
    assertTrue(Arrays.equals(opt.getValue(), HexUtils.hexToBytes("05DC0000FFFF")));
    assertTrue(Arrays.equals(shorts, opt.getValueAsShorts()));
  }
View Full Code Here

//  public void testNewOptionAsShortsBad() {
//    DHCPOption.newOptionAsShort(DHO_DHCP_LEASE_TIME, (short) 0);
//  }
  @Test (expected=IllegalArgumentException.class)
  public void testGetValueAsShortsBad() {
    DHCPOption opt = new DHCPOption(DHO_DHCP_LEASE_TIME, new byte[0]);
    opt.getValueAsShorts();
  }
View Full Code Here

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

    DHCPOption opt = new DHCPOption(DHO_PATH_MTU_PLATEAU_TABLE, null);
    opt.getValueAsShorts();
  }
  @Test (expected=DHCPBadPacketException.class)
  public void testGetValueAsShortsBadSize1() {
    DHCPOption opt = new DHCPOption(DHO_PATH_MTU_PLATEAU_TABLE, new byte[1]);
    opt.getValueAsShorts();
  }
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.