public void S7_StaticVirtualChannel_NegativeTest_InvalidTPKTLength()
{
#region Test Description
/*
1. Trigger SUT to initiate and complete a RDP connection.
2. After the connection sequence has been finished, Test Suite sends a Save Session Info PDU with a notification type of the INFOTYPE_LOGON (0x00000000), INFOTYPE_LOGON_LONG (0x00000001),
or INFOTYPE_LOGON_PLAINNOTIFY (0x00000002) to notify the SUT that the user has logged on (how to determine the notification type is described in TD section 3.3.5.10) .
3. Test Suite sends SUT a Static Virtual Channel PDU and set the length field of tpktHeader to an invalid value (less than the actual value).
4. Test Suite expects SUT drops the connection.
*/
#endregion
#region Test Sequence
this.TestSite.Assert.IsTrue(isClientSupportRDPEFS, "To execute test cases of S7, RDP client should support [MS-RDPEFS]: Remote Desktop Protocol: File System Virtual Channel Extension.");
//Start RDP listening.
this.TestSite.Log.Add(LogEntryKind.Comment, "Starting RDP listening.");
this.rdpbcgrAdapter.StartRDPListening(transportProtocol);
#region Trigger client to connect
//Trigger client to connect.
this.TestSite.Log.Add(LogEntryKind.Comment, "Triggering SUT to initiate a RDP connection to server.");
triggerClientRDPConnect(transportProtocol);
#endregion
//Waiting for the transport level connection request.
this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting the transport layer connection request.");
this.rdpbcgrAdapter.ExpectTransportConnection(RDPSessionType.Normal);
//Set Server Capability with Bitmap Host Cache supported.
this.TestSite.Log.Add(LogEntryKind.Comment, "Setting Server Capability. Virtual Channel compression is not supported.");
this.rdpbcgrAdapter.SetServerCapability(true, true, true, true, true, true, true, true, false, true);
//Waiting for the RDP connection sequence.
this.TestSite.Log.Add(LogEntryKind.Comment, "Establishing RDP connection.");
this.rdpbcgrAdapter.EstablishRDPConnection(selectedProtocol, enMethod, enLevel, true, false, rdpServerVersion);
this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Server Save Session Info PDU to SUT to notify user has logged on.");
this.rdpbcgrAdapter.ServerSaveSessionInfo(LogonNotificationType.UserLoggedOn, ErrorNotificationType_Values.LOGON_FAILED_OTHER);
//Check whether 'rdpdr' channel has been created
if (this.rdpbcgrAdapter.GetStaticVirtualChannelId("RDPDR") == 0)
{
this.TestSite.Assume.Fail("The necessary channel RDPDR has not been created, so stop running this test case.");
}
this.TestSite.Log.Add(LogEntryKind.Comment, "Sending SUT a Static Virtual Channel PDU and filling the length field of tpktHeader to an invalid value (less than the actual value)");
SendStaticVirtualChannelTraffics(StaticVirtualChannel_InvalidType.InvalidTPKTLength);
this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting SUT drop the connection.");
bool isDisconnected = this.rdpbcgrAdapter.WaitForDisconnection(waitTime);
this.TestSite.Assert.IsTrue(isDisconnected, "SUT should drop the connection when received an invalid static virtual channel pdu.");
#endregion
}