Fix test failures caused by connection resets (#1167).

This commit is contained in:
Cesar Blum Silveira 2016-10-28 17:03:11 -07:00
parent 5e97c63467
commit cc05e36dc6
1 changed files with 5 additions and 4 deletions

View File

@ -580,6 +580,7 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
{ {
using (var server = new TestServer(async httpContext => 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))); Assert.Equal(0, await httpContext.Request.Body.ReadAsync(new byte[1], 0, 1).TimeoutAfter(TimeSpan.FromSeconds(10)));
}, testContext)) }, testContext))
{ {
@ -592,8 +593,8 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
"GET / HTTP/1.1", "GET / HTTP/1.1",
"Connection: close", "Connection: close",
"", "",
"a"); "");
await connection.ReceiveEnd( await connection.ReceiveForcedEnd(
"HTTP/1.1 200 OK", "HTTP/1.1 200 OK",
"Connection: close", "Connection: close",
$"Date: {testContext.DateHeaderValue}", $"Date: {testContext.DateHeaderValue}",
@ -607,8 +608,8 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
await connection.Send( await connection.Send(
"GET / HTTP/1.0", "GET / HTTP/1.0",
"", "",
"a"); "");
await connection.ReceiveEnd( await connection.ReceiveForcedEnd(
"HTTP/1.1 200 OK", "HTTP/1.1 200 OK",
"Connection: close", "Connection: close",
$"Date: {testContext.DateHeaderValue}", $"Date: {testContext.DateHeaderValue}",