From cc05e36dc628ef3f99446195f12def4db2712401 Mon Sep 17 00:00:00 2001 From: Cesar Blum Silveira Date: Fri, 28 Oct 2016 17:03:11 -0700 Subject: [PATCH] Fix test failures caused by connection resets (#1167). --- .../EngineTests.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/EngineTests.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/EngineTests.cs index 8c961f81ec..ef73602834 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/EngineTests.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/EngineTests.cs @@ -580,6 +580,7 @@ namespace Microsoft.AspNetCore.Server.KestrelTests { using (var server = new TestServer(async httpContext => { + // This will hang if 0 content length is not assumed by the server Assert.Equal(0, await httpContext.Request.Body.ReadAsync(new byte[1], 0, 1).TimeoutAfter(TimeSpan.FromSeconds(10))); }, testContext)) { @@ -592,8 +593,8 @@ namespace Microsoft.AspNetCore.Server.KestrelTests "GET / HTTP/1.1", "Connection: close", "", - "a"); - await connection.ReceiveEnd( + ""); + await connection.ReceiveForcedEnd( "HTTP/1.1 200 OK", "Connection: close", $"Date: {testContext.DateHeaderValue}", @@ -607,8 +608,8 @@ namespace Microsoft.AspNetCore.Server.KestrelTests await connection.Send( "GET / HTTP/1.0", "", - "a"); - await connection.ReceiveEnd( + ""); + await connection.ReceiveForcedEnd( "HTTP/1.1 200 OK", "Connection: close", $"Date: {testContext.DateHeaderValue}",