From 3d1e5a43aa7172a7176652541083b82db551ec54 Mon Sep 17 00:00:00 2001 From: Stephen Halter Date: Tue, 8 Nov 2016 23:38:58 -0800 Subject: [PATCH] Make ConnectionFilterTests more reliable --- .../ConnectionFilterTests.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/ConnectionFilterTests.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/ConnectionFilterTests.cs index ea7664656..6ef4b9de2 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/ConnectionFilterTests.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/ConnectionFilterTests.cs @@ -89,11 +89,19 @@ public async Task ThrowingSynchronousConnectionFilterDoesNotCrashServer() using (var connection = server.CreateConnection()) { // Will throw because the exception in the connection filter will close the connection. - await Assert.ThrowsAsync(async () => await connection.SendEnd( - "POST / HTTP/1.0", - "Content-Length: 12", - "", - "Hello World?")); + await Assert.ThrowsAsync(async () => + { + await connection.Send( + "POST / HTTP/1.0", + "Content-Length: 1000", + "\r\n"); + + for (var i = 0; i < 1000; i++) + { + await connection.Send("a"); + await Task.Delay(5); + } + }); } } }