@Test
public void testEncode()
{
Compression c = new Compression();
Buffer buffer = new ByteArrayBuffer(512);
Name cipango = new Name("cipango.org");
Name www = new Name("www.cipango.org");
Name org = new Name("org");
c.encodeName(cipango, buffer);
c.encodeName(www, buffer);
c.encodeName(cipango, buffer);
c.encodeName(org, buffer);
Assert.assertEquals(23, buffer.length());
c = new Compression();
Assert.assertEquals(cipango, c.decodeName(buffer));
Assert.assertEquals(www, c.decodeName(buffer));
Assert.assertEquals(cipango, c.decodeName(buffer));
Assert.assertEquals(org, c.decodeName(buffer));
Assert.assertFalse(buffer.hasContent());
}