aspnetcore/test/Microsoft.AspNetCore.Server.../TestHelpers/MockConnection.cs

27 lines
644 B
C#

using System;
using System.Threading;
using Microsoft.AspNetCore.Server.Kestrel.Networking;
using Microsoft.AspNetCore.Server.Kestrel.Http;
namespace Microsoft.AspNetCore.Server.KestrelTests.TestHelpers
{
public class MockConnection : Connection
{
public MockConnection(UvStreamHandle socket)
: base (new ListenerContext(), socket)
{
}
public override void Abort()
{
if (RequestAbortedSource != null)
{
RequestAbortedSource.Cancel();
}
}
public CancellationTokenSource RequestAbortedSource { get; set; }
}
}