Add test for transport close during sasl negotiation.

This commit is contained in:
xinchen 2016-11-20 20:16:37 -08:00
Родитель 590cddb9bf
Коммит 7fd64c0cc3
1 изменённых файлов: 32 добавлений и 1 удалений

Просмотреть файл

@ -242,7 +242,7 @@ namespace Test.Amqp
}
[TestMethod]
public void InvalidSaslProtocolHeaderTest()
public void SaslInvalidProtocolHeaderTest()
{
Stream transport = null;
@ -292,6 +292,37 @@ namespace Test.Amqp
}).Unwrap().GetAwaiter().GetResult();
}
[TestMethod]
public void SaslCloseTransportTest()
{
this.testListener.RegisterTarget(TestPoint.SaslInit, (stream, channel, fields) =>
{
stream.Dispose();
return TestOutcome.Stop;
});
Address myAddress = new Address("amqp://guest:@" + this.address.Host + ":" + this.address.Port);
Trace.WriteLine(TraceLevel.Information, "sync test");
{
try
{
Connection connection = new Connection(myAddress);
Assert.IsTrue(false, "no exception was thrown 1");
}
catch (ObjectDisposedException) { }
}
Trace.WriteLine(TraceLevel.Information, "async test");
Task.Factory.StartNew(async () =>
{
try
{
Connection connection = await Connection.Factory.CreateAsync(myAddress);
}
catch (ObjectDisposedException) { }
}).Unwrap().GetAwaiter().GetResult();
}
[TestMethod]
public void SendWithInvalidRemoteChannelTest()
{