Package org.xbill.DNS

Examples of org.xbill.DNS.Name.toWire()


    {
  public void test_rel() throws TextParseException
  {
      Name n = new Name("A.Relative.Name");
      try {
    n.toWire(new DNSOutput(), null);
    fail("IllegalArgumentException not thrown");
      }
      catch(IllegalArgumentException e){}
  }
View Full Code Here


  {
      byte[] raw = new byte[] { 1, 'A', 5, 'B', 'a', 's', 'i', 'c', 4, 'N', 'a', 'm', 'e', 0 };
      Name n = new Name("A.Basic.Name.");
     
      DNSOutput o = new DNSOutput();
      n.toWire(o, null);

      assertTrue(Arrays.equals(raw, o.toByteArray()));
  }

  public void test_empty_Compression() throws TextParseException
View Full Code Here

      byte[] raw = new byte[] { 1, 'A', 5, 'B', 'a', 's', 'i', 'c', 4, 'N', 'a', 'm', 'e', 0 };
      Name n = new Name("A.Basic.Name.");
     
      Compression c = new Compression();
      DNSOutput o = new DNSOutput();
      n.toWire(o, c);

      assertTrue(Arrays.equals(raw, o.toByteArray()));
      assertEquals(0, c.get(n));
  }
View Full Code Here

      Compression c = new Compression();
      c.add(256, n);
      byte[] exp = new byte[] { (byte)0xC1, 0x0 };

      DNSOutput o = new DNSOutput();
      n.toWire(o, c);
      assertTrue(Arrays.equals(exp, o.toByteArray()));
      assertEquals(256, c.get(n));
  }

  public void test_with_partial_Compression() throws TextParseException
View Full Code Here

      Compression c = new Compression();
      c.add(257, d);
      byte[] exp = new byte[] { 1, 'A', (byte)0xC1, 0x1 };

      DNSOutput o = new DNSOutput();
      n.toWire(o, c);
      assertTrue(Arrays.equals(exp, o.toByteArray()));
      assertEquals(257, c.get(d));
      assertEquals(0, c.get(n));
  }
View Full Code Here

  public void test_0arg_rel() throws TextParseException
  {
      Name n = new Name("A.Relative.Name");
      try {
    n.toWire();
    fail("IllegalArgumentException not thrown");
      }
      catch(IllegalArgumentException e){}
  }
View Full Code Here

  public void test_0arg() throws TextParseException
  {
      byte[] raw = new byte[] { 1, 'A', 5, 'B', 'a', 's', 'i', 'c', 4, 'N', 'a', 'm', 'e', 0 };
      Name n = new Name("A.Basic.Name.");
     
      byte[] out = n.toWire();

      assertTrue(Arrays.equals(raw, out));
  }

  public void test_root()
View Full Code Here

      Compression c = new Compression();
      c.add(257, d);
      byte[] exp = new byte[] { 1, 'A', (byte)0xC1, 0x1 };

      DNSOutput o = new DNSOutput();
      n.toWire(o, c, false);
      assertTrue(Arrays.equals(exp, o.toByteArray()));
      assertEquals(257, c.get(d));
      assertEquals(0, c.get(n));
  }
    }
View Full Code Here

      Compression c = new Compression();
      c.add(257, d);
      byte[] exp = new byte[] { 1, 'a', 5, 'b', 'a', 's', 'i', 'c', 4, 'n', 'a', 'm', 'e', 0 };

      DNSOutput o = new DNSOutput();
      n.toWire(o, c, true);
      assertTrue(Arrays.equals(exp, o.toByteArray()));
      assertEquals(257, c.get(d));
      assertEquals(-1, c.get(n));
  }
    }
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.