From 8f9eb68c7e8f4c91871efccb855d0065fb6a701d Mon Sep 17 00:00:00 2001 From: Rhys Parry Date: Wed, 29 Apr 2026 03:47:34 +0000 Subject: [PATCH] Accept Windows TCP connect timeout in ExceptionContractFixture On Windows 2019, disposing the port forwarder causes TCP SYN packets to be dropped rather than immediately refused (no RST), so the client gets a connect timeout instead of "Connection refused". Add the Windows timeout message to the ContainAny assertion so the test passes on both platforms. Co-Authored-By: Claude Sonnet 4.6 --- source/Halibut.Tests/ExceptionContractFixture.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/Halibut.Tests/ExceptionContractFixture.cs b/source/Halibut.Tests/ExceptionContractFixture.cs index 3589e976..eb1ae5bc 100644 --- a/source/Halibut.Tests/ExceptionContractFixture.cs +++ b/source/Halibut.Tests/ExceptionContractFixture.cs @@ -125,7 +125,9 @@ public async Task WhenTheListeningRequestFailsToBeSent_AsTheServiceDoesNotAccept (await AssertException.Throws(async () => await client.SayHelloAsync("Hello", new(CancellationToken)))) .And.Message.Should().ContainAny( $"An error occurred when sending a request to '{clientAndService.ServiceUri}', before the request could begin: No connection could be made because the target machine actively refused it", - $"An error occurred when sending a request to '{clientAndService.ServiceUri}', before the request could begin: Connection refused"); + $"An error occurred when sending a request to '{clientAndService.ServiceUri}', before the request could begin: Connection refused", + // On Windows, a disposed port forwarder causes a TCP connect timeout rather than an immediate RST + $"An error occurred when sending a request to '{clientAndService.ServiceUri}', before the request could begin: The client was unable to establish the initial connection within the timeout"); } [Test]