From 32d380a05801bda255bbf9d758298b8285e52ea5 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Thu, 2 Aug 2018 09:09:25 -0700 Subject: [PATCH] Don't send WebSocketCloseStatus.Empty, it's invalid (#2716) --- test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs b/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs index 6062003ce7..fc91abb899 100644 --- a/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs +++ b/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs @@ -118,10 +118,11 @@ namespace Microsoft.AspNetCore.SignalR.Tests Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray()); logger.LogInformation("Closing socket"); - await ws.CloseOutputAsync(WebSocketCloseStatus.Empty, "", CancellationToken.None).OrTimeout(); + await ws.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "", CancellationToken.None).OrTimeout(); logger.LogInformation("Waiting for close"); result = await ws.ReceiveAsync(buffer, CancellationToken.None).OrTimeout(); Assert.Equal(WebSocketMessageType.Close, result.MessageType); + Assert.Equal(WebSocketCloseStatus.NormalClosure, result.CloseStatus); logger.LogInformation("Closed socket"); } } @@ -156,10 +157,11 @@ namespace Microsoft.AspNetCore.SignalR.Tests Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray()); logger.LogInformation("Closing socket"); - await ws.CloseOutputAsync(WebSocketCloseStatus.Empty, "", CancellationToken.None).OrTimeout(); + await ws.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "", CancellationToken.None).OrTimeout(); logger.LogInformation("Waiting for close"); result = await ws.ReceiveAsync(buffer, CancellationToken.None).OrTimeout(); Assert.Equal(WebSocketMessageType.Close, result.MessageType); + Assert.Equal(WebSocketCloseStatus.NormalClosure, result.CloseStatus); logger.LogInformation("Closed socket"); } }