public void ReadDisconnectPayloadTest()
        {
            var buffer = ByteBufferAllocator.NewBuffer(DataSerializer.Endian);

            var detailMessage = "Invalid CommandType";
            var srcDetail     = Encoding.UTF8.GetBytes(detailMessage);

            buffer.WriteInt((int)DisconnectReason.InvalidDataFormat);
            buffer.WriteInt(srcDetail.Length);
            buffer.WriteBytes(srcDetail);

            byte[] payload = buffer.ToArray();
            int    offset  = 0;

            DisconnectReason disconnectType = (DisconnectReason)ByteRead.GetInt(payload, ref offset);

            int detailLength = ByteRead.GetInt(payload, ref offset);

            byte[] dstDetail = new byte[detailLength];
            ByteRead.ReadBytes(payload, dstDetail, offset, 0, detailLength);

            Assert.AreEqual(DisconnectReason.InvalidDataFormat, disconnectType);
            Assert.AreEqual(srcDetail.Length, detailLength);
            Assert.AreEqual(detailMessage, Encoding.UTF8.GetString(dstDetail));
        }