diff --git a/test/WireMock.Net.Tests/WebSockets/WebSocketIntegrationTests.cs b/test/WireMock.Net.Tests/WebSockets/WebSocketIntegrationTests.cs index 546a82bf..201e652a 100644 --- a/test/WireMock.Net.Tests/WebSockets/WebSocketIntegrationTests.cs +++ b/test/WireMock.Net.Tests/WebSockets/WebSocketIntegrationTests.cs @@ -769,7 +769,7 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc public async Task WithWebSocketProxy_Should_Proxy_Binary_Messages() { // Arrange - Start target echo server - using var exampleEchoServer = WireMockServer.Start(new WireMockServerSettings + var exampleEchoServer = WireMockServer.Start(new WireMockServerSettings { Logger = new TestOutputHelperWireMockLogger(output), Urls = ["ws://localhost:0"] @@ -785,7 +785,7 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc ); // Arrange - Start proxy server - using var sut = WireMockServer.Start(new WireMockServerSettings + var sut = WireMockServer.Start(new WireMockServerSettings { Logger = new TestOutputHelperWireMockLogger(output), Urls = ["ws://localhost:0"] @@ -819,6 +819,14 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc receivedData.Should().BeEquivalentTo(testData, "binary data should be proxied and echoed back"); await client.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct); + + await Task.Delay(250, _ct); + + sut.Stop(); + sut.Dispose(); + + exampleEchoServer.Stop(); + exampleEchoServer.Dispose(); } [Fact]