@Test
public void DeserializeBinary()
{
OSD theSD = null;
OSDArray array = null;
OSDBinary tempBinary = null;
String testSD = "<?xml version='1.0' encoding='UTF-8'?> \n" +
"<llsd> \n" +
"<array> \n" +
"<binary encoding='base64'>cmFuZG9t</binary> \n" +
"<binary>dGhlIHF1aWNrIGJyb3duIGZveA==</binary> \n" +
"<binary/> \n" +
"</array> \n" +
"</llsd>";
//Deserialize the string
byte[] bytes = Utils.stringToBytes(testSD);
theSD =XmlLLSDOSDParser.DeserializeLLSDXml(bytes);
Assert.assertTrue(theSD instanceof OSDArray);
array = (OSDArray)theSD;
Assert.assertEquals(OSDType.Binary, array.get(0).getType());
tempBinary = (OSDBinary)array.get(0);
byte[] testData1 = {114, 97, 110, 100, 111, 109};
TestHelper.TestBinary(tempBinary, testData1);
Assert.assertEquals(OSDType.Binary, array.get(1).getType());
tempBinary = (OSDBinary)array.get(1);
byte[] testData2 = {116, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98,
114, 111, 119, 110, 32, 102, 111, 120};
TestHelper.TestBinary(tempBinary, testData2);
Assert.assertEquals(OSDType.Binary, array.get(1).getType());
tempBinary = (OSDBinary)array.get(2);
Assert.assertEquals(0, tempBinary.asBinary().length);
}