public void HostedCacheServer_PchcServer_BatchedOffer_SegmentDescriptorTooMany()
{
CheckApplicability();
var contentInformation = contentInformationUtility.CreateContentInformationV2();
using (var pccrrServer = new PccrrServer(testConfig.ClientContentRetrievalListenPort))
{
pccrrServer.StartListening();
pccrrServer.MessageArrived += new MessageArrivedEventArgs(delegate(IPEndPoint sender, PccrrPacket pccrrPacket)
{
BaseTestSite.Assert.Fail("Hosted cache server should not retrieve content information with more than 128 segment descriptions");
});
PCHCClient pchcClient = new PCHCClient(
TransferProtocol.HTTP,
testConfig.HostedCacheServerComputerName,
testConfig.HostedCacheServerHTTPListenPort,
PchcConsts.HttpUrl,
testConfig.DomainName,
testConfig.UserName,
testConfig.UserPassword);
var batchedOffer = pchcClient.CreateBatchedOfferMessage(
testConfig.ClientContentRetrievalListenPort,
contentInformation);
List<SegmentDescriptor> segmentDescriptors = new List<SegmentDescriptor>();
for (int i = 0; i < 129; i++)
{
segmentDescriptors.Add(batchedOffer.SegmentDescriptors[0]);
}
batchedOffer.SegmentDescriptors = segmentDescriptors.ToArray();
bool passed = false;
try
{
pchcClient.SendBatchedOfferMessage(batchedOffer);
}
catch
{
passed = true;
}
BaseTestSite.Assert.IsTrue(passed, "Hosted cache server should drop invalid batched offer request");
}
}