public async Task TestPacketWriteByteArray()
        {
            var packet = new MutablePacket();
            packet.Write(new byte[] { 5, 11, 27, 30 });
            var bytes = packet.Lock();
            Assert.IsTrue(bytes.Length >= 4 && bytes[0] == 5 && bytes[1] == 11 && bytes[2] == 27 && bytes[3] == 30, "Failed to write byte array to packet");
            if (packet.Locked)
            {
                var task = new Task(() => packet.Write(new byte[] { 99, 12 }));
                task.Start();
                Assert.IsTrue(await TaskTimesOut(TimeSpan.FromSeconds(2), task), "Packet reported being locked after locking but was still mutable");
            }

            else
            {
                bytes[0] = 72;
                var newBytes = packet.Lock();
                if (newBytes[0] != 5)
                    Assert.Fail("Packet reported not being locked but the buffer was returned by reference not copy. Return a full copy of the buffer if you wish to unlock else ensure you set the buffer to a locked state when Lock() is called.");
            }
        }