/// <summary>
        /// Receives the ADD_VIRTUAL_CHANNEL request from the client.
        /// </summary>
        /// <param name="channelId">The channel received in.</param>
        public void ExpectAddVirtualChannel(DynamicVirtualChannel channel)
        {
            Site.Log.Add(LogEntryKind.Debug, "Receiving ADD_VIRTUAL_CHANNEL: Channel ID {0}", channel.ChannelId);

            EusbAddVirtualChannelPdu responsePdu = this.rdpeusbServer.ExpectRdpeusbPdu <EusbAddVirtualChannelPdu>(channel.ChannelId, waitTime);

            #region Verify ADD_VIRTUAL_CHANNEL

            Site.Assert.IsNotNull(
                responsePdu,
                "Expect that the response from the client is EusbAddVirtualChannelPdu.");

            // Log this PDU if responsePdu is not null
            LogPdu(responsePdu);

            Site.Assert.AreEqual <uint>(
                0x00000001,
                responsePdu.InterfaceId,
                "Expect that the InterfaceId in the response PDU equals 0x00000001. The actual value is 0x{0:x8}.",
                responsePdu.InterfaceId);

            Site.Assert.AreEqual <Mask_Values>(
                Mask_Values.STREAM_ID_PROXY,
                responsePdu.Mask,
                "Expect that the Mask in the response PDU is STREAM_ID_PROXY.");

            Site.Assert.AreEqual <FunctionId_Values>(
                FunctionId_Values.ADD_VIRTUAL_CHANNEL,
                (FunctionId_Values)responsePdu.FunctionId,
                "Expect that the FunctionId in the response PDU is ADD_VIRTUAL_CHANNEL. The actual value is 0x{0:x8}.",
                responsePdu.FunctionId);

            #endregion
        }
        public override EusbPdu ParsePdu(byte[] data)
        {
            EusbPdu pdu;

            switch (GetPduType(data))
            {
            case EusbType.RIM_EXCHANGE_CAPABILITY_REQUEST:
                pdu = new EusbRimExchangeCapResponsePdu();
                break;

            case EusbType.ADD_VIRTUAL_CHANNEL:
                pdu = new EusbAddVirtualChannelPdu();
                break;

            case EusbType.ADD_DEVICE:
                pdu = new EusbAddDevicePdu();
                break;

            case EusbType.CHANNEL_CREATED:
                pdu = new EusbChannelCreatedPdu(false);
                break;

            case EusbType.QUERY_DEVICE_TEXT:
                pdu = new EusbQueryDeviceTextResponsePdu();
                break;

            case EusbType.IOCONTROL_COMPLETION:
                pdu = new EusbIoControlCompletionPdu();
                break;

            case EusbType.URB_COMPLETION:
                pdu = new EusbUrbCompletionPdu();
                break;

            case EusbType.URB_COMPLETION_NO_DATA:
                pdu = new EusbUrbCompletionNoDataPdu();
                break;

            default:
                return(base.ParsePdu(data));
            }

            if (!PduMarshaler.Unmarshal(data, pdu))
            {
                pdu = new EusbUnknownPdu();
                PduMarshaler.Unmarshal(data, pdu);
            }
            return(pdu);
        }