diff --git a/source/doap/packet.d b/source/doap/packet.d index efa44f2..8f35d8c 100644 --- a/source/doap/packet.d +++ b/source/doap/packet.d @@ -37,7 +37,7 @@ public class CoapPacket // Set the request/response code encoded ~= code; - // Set the message ID + // Set the message ID (encoded as big endian) version(LittleEndian) { ubyte* basePtr = cast(ubyte*)∣ @@ -129,6 +129,8 @@ unittest packet.setCode(Code.PONG); + packet.setMessageId(257); + @@ -162,4 +164,9 @@ unittest writeln(code); assert(secondByte == Code.PONG); + // Ensure the message ID is 257 + ubyte thirdByte = encoded[2], fourthByte = encoded[3]; + assert(thirdByte == 1); + assert(fourthByte == 1); + } \ No newline at end of file