public void resultingSizeZeroLValue() { ByteBuffer result = new ByteBuffer(new byte[1024]); STUNTypeLengthValue.Value(0, new ByteBuffer(ByteBuffer.ZeroLengthBuffer), ref result); Assert.AreEqual(4, result.Position); }
public void lengthPosition() { ByteBuffer result = new ByteBuffer(new byte[1024]); STUNTypeLengthValue.Value(0, new ByteBuffer(new byte[257]), ref result); Assert.AreEqual(0, result[0]); Assert.AreEqual(0, result[1]); Assert.AreEqual(1, result[2]); Assert.AreEqual(1, result[3]); }
public void resultingSizeThreeLValue() { ByteBuffer result = new ByteBuffer(new byte[1024]); STUNTypeLengthValue.Value(0, new ByteBuffer(new byte[] { 0xff, 0xff, 0xff }), ref result); Assert.AreEqual(8, result.Position); Assert.AreEqual(0xff, result[4]); Assert.AreEqual(0xff, result[5]); Assert.AreEqual(0xff, result[6]); Assert.AreEqual(0, result[7]); }
/// <summary> /// Add a value to the STUN message. /// </summary> /// <param name="type">The message type</param> /// <param name="value">The message value</param> /// <returns>This builder, never null</returns> public void WriteAttribute(int type, byte[] value) { STUNTypeLengthValue.Value(type, value, ref buffer); UpdateHeaderAttributesLength(ref buffer, buffer.Position); }