An exception occurs when adding multiple proto definitions in the TestContainer. #737

Closed
opened 2025-12-29 15:32:40 +01:00 by adam · 10 comments
Owner

Originally created by @Allen0117 on GitHub (Dec 22, 2025).

Originally assigned to: @StefH on GitHub.

Describe the bug

I found that when only one proto definition is added, my test case passes successfully; however, once more than one is added, the following error occurs.
When reporting the issue, I found the behavior to be quite unstable—it sometimes passes and sometimes fails.

Exception Detail

[testcontainers.org 00:00:04.18] Error adding ProtoDefinition 'gifting'.
System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.Net.Http.HttpIOException: The response ended prematurely. (ResponseEnded)
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody)
   at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo)
   at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync()
[testcontainers.org 00:00:04.19] Error adding ProtoDefinition 'gifting'.
System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
 ---> System.Net.Sockets.SocketException (54): Connection reset by peer
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
   at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async)
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody)
   at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo)
   at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync()
[testcontainers.org 00:00:04.19] Error adding ProtoDefinition 'gifting'.
System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
 ---> System.Net.Sockets.SocketException (54): Connection reset by peer
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
   at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async)
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody)
   at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo)
   at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync()
[testcontainers.org 00:00:04.19] Error adding ProtoDefinition 'gifting'.
System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
 ---> System.Net.Sockets.SocketException (54): Connection reset by peer
   --- End of inner exception stack trace ---

Test code

_wireMockContainer = new WireMockContainerBuilder()
            .AddUrl("http://*:1081")
            .AddUrl("grpc://*:1082")
            .AddProtoDefinition("transfer", transferSource, customDatetimeSource, customDecimalSource, requestSource, responseSource)
            .AddProtoDefinition("gifting", giftingSource, customDatetimeSource, customDecimalSource, requestSource, responseSource)
            .WithPortBinding(10801, 1081)
            .WithPortBinding(10802, 1082)
            .WithHttp2()
            .Build();

await _wireMockAdminApi.PostMappingAsync(new MappingModel
        {
            Guid = Guid.NewGuid(),
            Request = new RequestModel
            {
                Path = new PathModel()
                {
                    Matchers =
                    [
                        new MatcherModel()
                        {
                            Name = "WildcardMatcher",
                            Pattern = "/transfer.Transfer/TransferBonus",
                            IgnoreCase = false,
                        }
                    ]
                },
                Methods = ["POST"],
                Body = new BodyModel()
                {
                    Matcher = new MatcherModel()
                    {
                        ProtoBufMessageType = "TransferBonusRequest",
                        Name = "ProtoBufMatcher",
                    }
                }
            },
            Response = new ResponseModel
            {
                BodyAsJson = new { ErrorCode = 101 },
                UseTransformer = true,
                TransformerType = "Handlebars",
                TransformerReplaceNodeOptions = "EvaluateAndTryToConvert",
                Headers = new Dictionary<string, object>
                {
                    { "Content-Type", "application/grpc" }
                },
                TrailingHeaders = new Dictionary<string, object>
                {
                    { "grpc-status", StatusCode.OK.ToString("D") }
                },
                ProtoBufMessageType = "TransferBonusResponse",
            },
            ProtoDefinition = "transfer"
        });
        
        
        var transferClient = new Transfer.Transfer.TransferClient(_grpcChannel);
        
Originally created by @Allen0117 on GitHub (Dec 22, 2025). Originally assigned to: @StefH on GitHub. ### Describe the bug I found that when only one proto definition is added, my test case passes successfully; however, once more than one is added, the following error occurs. **When reporting the issue, I found the behavior to be quite unstable—it sometimes passes and sometimes fails.** ### Exception Detail ``` C# [testcontainers.org 00:00:04.18] Error adding ProtoDefinition 'gifting'. System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.Http.HttpIOException: The response ended prematurely. (ResponseEnded) at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody) at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo) at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync() [testcontainers.org 00:00:04.19] Error adding ProtoDefinition 'gifting'. System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException (54): Connection reset by peer --- End of inner exception stack trace --- at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token) at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async) at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody) at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo) at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync() [testcontainers.org 00:00:04.19] Error adding ProtoDefinition 'gifting'. System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException (54): Connection reset by peer --- End of inner exception stack trace --- at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token) at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async) at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody) at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo) at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync() [testcontainers.org 00:00:04.19] Error adding ProtoDefinition 'gifting'. System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException (54): Connection reset by peer --- End of inner exception stack trace --- ``` ### Test code ``` C# _wireMockContainer = new WireMockContainerBuilder() .AddUrl("http://*:1081") .AddUrl("grpc://*:1082") .AddProtoDefinition("transfer", transferSource, customDatetimeSource, customDecimalSource, requestSource, responseSource) .AddProtoDefinition("gifting", giftingSource, customDatetimeSource, customDecimalSource, requestSource, responseSource) .WithPortBinding(10801, 1081) .WithPortBinding(10802, 1082) .WithHttp2() .Build(); await _wireMockAdminApi.PostMappingAsync(new MappingModel { Guid = Guid.NewGuid(), Request = new RequestModel { Path = new PathModel() { Matchers = [ new MatcherModel() { Name = "WildcardMatcher", Pattern = "/transfer.Transfer/TransferBonus", IgnoreCase = false, } ] }, Methods = ["POST"], Body = new BodyModel() { Matcher = new MatcherModel() { ProtoBufMessageType = "TransferBonusRequest", Name = "ProtoBufMatcher", } } }, Response = new ResponseModel { BodyAsJson = new { ErrorCode = 101 }, UseTransformer = true, TransformerType = "Handlebars", TransformerReplaceNodeOptions = "EvaluateAndTryToConvert", Headers = new Dictionary<string, object> { { "Content-Type", "application/grpc" } }, TrailingHeaders = new Dictionary<string, object> { { "grpc-status", StatusCode.OK.ToString("D") } }, ProtoBufMessageType = "TransferBonusResponse", }, ProtoDefinition = "transfer" }); var transferClient = new Transfer.Transfer.TransferClient(_grpcChannel); ```
adam added the bug label 2025-12-29 15:32:40 +01:00
adam closed this issue 2025-12-29 15:32:41 +01:00
Author
Owner

@StefH commented on GitHub (Dec 22, 2025):

@Allen0117
Can you please provide the logging?
And specifically anything with "ProtoDefinition".

@StefH commented on GitHub (Dec 22, 2025): @Allen0117 Can you please provide the logging? And specifically anything with "ProtoDefinition".
Author
Owner

@Allen0117 commented on GitHub (Dec 23, 2025):

Hi @StefH
Continaer logging

[testcontainers.org 00:00:00.06] Connected to Docker:
  Host: unix:///var/run/docker.sock
  Server Version: 28.5.2
  Kernel Version: 6.17.8-orbstack-00308-g8f9c941121b1
  API Version: 1.51
  Operating System: OrbStack
  Total Memory: 15.65 GB
[testcontainers.org 00:00:00.16] Docker container 8ba4ebbde45a created
[testcontainers.org 00:00:00.18] Start Docker container 8ba4ebbde45a
[testcontainers.org 00:00:00.27] Wait for Docker container 8ba4ebbde45a to complete readiness checks
[testcontainers.org 00:00:00.27] Docker container 8ba4ebbde45a ready
[testcontainers.org 00:00:02.36] Docker container 525ae3f686fa created
[testcontainers.org 00:00:02.36] Attach DotNet.Testcontainers.Configurations.RedirectStdoutAndStderrToStream at Docker container 525ae3f686fa
[testcontainers.org 00:00:02.37] Start Docker container 525ae3f686fa
[testcontainers.org 00:00:02.48] Wait for Docker container 525ae3f686fa to complete readiness checks
[testcontainers.org 00:00:03.50] Docker container 525ae3f686fa ready
[testcontainers.org 00:00:03.54] Adding ProtoDefinition transfer
[testcontainers.org 00:00:04.07] AddProtoDefinition 'transfer' result: StatusModel [Guid=, Status=ProtoDefinition added, Error=]
[testcontainers.org 00:00:04.09] AddProtoDefinition 'transfer' result: StatusModel [Guid=, Status=ProtoDefinition added, Error=]
[testcontainers.org 00:00:04.09] AddProtoDefinition 'transfer' result: StatusModel [Guid=, Status=ProtoDefinition added, Error=]
[testcontainers.org 00:00:04.09] AddProtoDefinition 'transfer' result: StatusModel [Guid=, Status=ProtoDefinition added, Error=]
[testcontainers.org 00:00:04.18] AddProtoDefinition 'transfer' result: StatusModel [Guid=, Status=ProtoDefinition added, Error=]
[testcontainers.org 00:00:04.18] Adding ProtoDefinition gifting
[testcontainers.org 00:00:04.21] Stop Docker container 525ae3f686fa
[testcontainers.org 00:00:14.30] Error adding ProtoDefinition 'gifting'.
System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.Net.Http.HttpIOException: The response ended prematurely. (ResponseEnded)
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody)
   at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo)
   at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync()
[testcontainers.org 00:00:14.31] Error adding ProtoDefinition 'gifting'.
System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
 ---> System.Net.Sockets.SocketException (54): Connection reset by peer
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
   at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async)
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody)
   at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo)
   at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync()
[testcontainers.org 00:00:14.31] Error adding ProtoDefinition 'gifting'.
System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
 ---> System.Net.Sockets.SocketException (54): Connection reset by peer
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
   at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async)
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody)
   at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo)
   at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync()
[testcontainers.org 00:00:14.31] Error adding ProtoDefinition 'gifting'.
System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
 ---> System.Net.Sockets.SocketException (54): Connection reset by peer
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
   at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async)
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody)
   at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo)
   at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync()
[testcontainers.org 00:00:14.31] Error adding ProtoDefinition 'gifting'.
System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
 ---> System.Net.Sockets.SocketException (54): Connection reset by peer
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
   at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async)
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody)
   at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo)
   at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync()
[testcontainers.org 00:00:14.31] Error calling /__admin/mappings/reloadStaticMappings
System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
 ---> System.Net.Sockets.SocketException (54): Connection reset by peer
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
   at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async)
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody)
   at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo)
   at WireMock.Net.Testcontainers.WireMockContainer.ReloadStaticMappingsAsync(CancellationToken cancellationToken)
[testcontainers.org 00:00:14.42] Delete Docker container 525ae3f686fa

ProtoDefinition Structure
Image

ProtoDefinition
transfer.proto

syntax = "proto3";
import "CustomType/customDecimal.proto";
import "CustomType/customDatetime.proto";
import "Messages/Req.proto";
import "Messages/Response.proto";


package transfer;

service Transfer {
  rpc TransferBonus (TransferBonusRequest) returns (TransferBonusResponse);
}

gifting.proto

syntax = "proto3";
import "CustomType/customDecimal.proto";
import "CustomType/customDatetime.proto";
import "Messages/Req.proto";
import "Messages/Response.proto";


package gifting;

service Gifting {
  rpc SendGifting (SendGiftingRequest) returns (SendGiftingResponse);
}

Req.proto

// Messages/Req.proto
syntax = "proto3";
import "CustomType/customDecimal.proto";
import "CustomType/customDatetime.proto";


message TransferBonusRequest{
  int32 CustomerId = 1;
  int32 ServiceProvider = 2;
  DecimalValue Amount = 3;
  string Description = 4;
  string DescriptionTranslated = 5;
  string Remark = 6;
  int32 CampaignRewardId = 7;
}

message SendGiftingRequest{
  int32 CustomerId = 1;
}

Response.proto

// Messages/Response.proto
syntax = "proto3";
import "CustomType/customDecimal.proto";
import "CustomType/customDatetime.proto";


message TransferBonusResponse{
  int32 ErrorCode = 1;
  DatetimeValue WinLostDate = 2;
}

message SendGiftingResponse{
  int32 ErrorCode = 1;
}

customDatetime.proto

// CustomType/customDatetime.proto
syntax = "proto3";
import "google/protobuf/timestamp.proto";

message DatetimeValue {
  google.protobuf.Timestamp Time = 1;
}

customDecimal.proto

// CustomType/customDecimal.proto
syntax = "proto3";

message DecimalValue {

  // Whole units part of the amount
  int64 units = 1;

  // Nano units of the amount (10^-9)
  // Must be same sign as units
  sfixed32 nanos = 2;
}
@Allen0117 commented on GitHub (Dec 23, 2025): Hi @StefH **Continaer logging** ```C# [testcontainers.org 00:00:00.06] Connected to Docker: Host: unix:///var/run/docker.sock Server Version: 28.5.2 Kernel Version: 6.17.8-orbstack-00308-g8f9c941121b1 API Version: 1.51 Operating System: OrbStack Total Memory: 15.65 GB [testcontainers.org 00:00:00.16] Docker container 8ba4ebbde45a created [testcontainers.org 00:00:00.18] Start Docker container 8ba4ebbde45a [testcontainers.org 00:00:00.27] Wait for Docker container 8ba4ebbde45a to complete readiness checks [testcontainers.org 00:00:00.27] Docker container 8ba4ebbde45a ready [testcontainers.org 00:00:02.36] Docker container 525ae3f686fa created [testcontainers.org 00:00:02.36] Attach DotNet.Testcontainers.Configurations.RedirectStdoutAndStderrToStream at Docker container 525ae3f686fa [testcontainers.org 00:00:02.37] Start Docker container 525ae3f686fa [testcontainers.org 00:00:02.48] Wait for Docker container 525ae3f686fa to complete readiness checks [testcontainers.org 00:00:03.50] Docker container 525ae3f686fa ready [testcontainers.org 00:00:03.54] Adding ProtoDefinition transfer [testcontainers.org 00:00:04.07] AddProtoDefinition 'transfer' result: StatusModel [Guid=, Status=ProtoDefinition added, Error=] [testcontainers.org 00:00:04.09] AddProtoDefinition 'transfer' result: StatusModel [Guid=, Status=ProtoDefinition added, Error=] [testcontainers.org 00:00:04.09] AddProtoDefinition 'transfer' result: StatusModel [Guid=, Status=ProtoDefinition added, Error=] [testcontainers.org 00:00:04.09] AddProtoDefinition 'transfer' result: StatusModel [Guid=, Status=ProtoDefinition added, Error=] [testcontainers.org 00:00:04.18] AddProtoDefinition 'transfer' result: StatusModel [Guid=, Status=ProtoDefinition added, Error=] [testcontainers.org 00:00:04.18] Adding ProtoDefinition gifting [testcontainers.org 00:00:04.21] Stop Docker container 525ae3f686fa [testcontainers.org 00:00:14.30] Error adding ProtoDefinition 'gifting'. System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.Http.HttpIOException: The response ended prematurely. (ResponseEnded) at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody) at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo) at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync() [testcontainers.org 00:00:14.31] Error adding ProtoDefinition 'gifting'. System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException (54): Connection reset by peer --- End of inner exception stack trace --- at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token) at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async) at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody) at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo) at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync() [testcontainers.org 00:00:14.31] Error adding ProtoDefinition 'gifting'. System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException (54): Connection reset by peer --- End of inner exception stack trace --- at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token) at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async) at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody) at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo) at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync() [testcontainers.org 00:00:14.31] Error adding ProtoDefinition 'gifting'. System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException (54): Connection reset by peer --- End of inner exception stack trace --- at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token) at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async) at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody) at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo) at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync() [testcontainers.org 00:00:14.31] Error adding ProtoDefinition 'gifting'. System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException (54): Connection reset by peer --- End of inner exception stack trace --- at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token) at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async) at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody) at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo) at WireMock.Net.Testcontainers.WireMockContainer.CallAdditionalActionsAfterStartedAsync() [testcontainers.org 00:00:14.31] Error calling /__admin/mappings/reloadStaticMappings System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException (54): Connection reset by peer --- End of inner exception stack trace --- at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token) at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async) at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody) at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo) at WireMock.Net.Testcontainers.WireMockContainer.ReloadStaticMappingsAsync(CancellationToken cancellationToken) [testcontainers.org 00:00:14.42] Delete Docker container 525ae3f686fa ``` **ProtoDefinition Structure** <img width="510" height="307" alt="Image" src="https://github.com/user-attachments/assets/2d02249b-cc72-4d05-99d4-532b67d87579" /> **ProtoDefinition** transfer.proto ```proto syntax = "proto3"; import "CustomType/customDecimal.proto"; import "CustomType/customDatetime.proto"; import "Messages/Req.proto"; import "Messages/Response.proto"; package transfer; service Transfer { rpc TransferBonus (TransferBonusRequest) returns (TransferBonusResponse); } ``` gifting.proto ```proto syntax = "proto3"; import "CustomType/customDecimal.proto"; import "CustomType/customDatetime.proto"; import "Messages/Req.proto"; import "Messages/Response.proto"; package gifting; service Gifting { rpc SendGifting (SendGiftingRequest) returns (SendGiftingResponse); } ``` Req.proto ```proto // Messages/Req.proto syntax = "proto3"; import "CustomType/customDecimal.proto"; import "CustomType/customDatetime.proto"; message TransferBonusRequest{ int32 CustomerId = 1; int32 ServiceProvider = 2; DecimalValue Amount = 3; string Description = 4; string DescriptionTranslated = 5; string Remark = 6; int32 CampaignRewardId = 7; } message SendGiftingRequest{ int32 CustomerId = 1; } ``` Response.proto ```proto // Messages/Response.proto syntax = "proto3"; import "CustomType/customDecimal.proto"; import "CustomType/customDatetime.proto"; message TransferBonusResponse{ int32 ErrorCode = 1; DatetimeValue WinLostDate = 2; } message SendGiftingResponse{ int32 ErrorCode = 1; } ``` customDatetime.proto ```proto // CustomType/customDatetime.proto syntax = "proto3"; import "google/protobuf/timestamp.proto"; message DatetimeValue { google.protobuf.Timestamp Time = 1; } ``` customDecimal.proto ```proto // CustomType/customDecimal.proto syntax = "proto3"; message DecimalValue { // Whole units part of the amount int64 units = 1; // Nano units of the amount (10^-9) // Must be same sign as units sfixed32 nanos = 2; } ```
Author
Owner

@StefH commented on GitHub (Dec 23, 2025):

I think the issue is that TestContainers indicates that the container is started, and I will send those post-requests to WireMock.Net, but I think that WireMock.Net is not fully started / healthy yet.

So I need to add something like I did do for Aspire:
https://github.com/wiremock/WireMock.Net/blob/master/src/WireMock.Net.Aspire/WireMockHealthCheck.cs

@StefH commented on GitHub (Dec 23, 2025): I think the issue is that TestContainers indicates that the container is started, and I will send those post-requests to WireMock.Net, but I think that WireMock.Net is not fully started / healthy yet. So I need to add something like I did do for Aspire: https://github.com/wiremock/WireMock.Net/blob/master/src/WireMock.Net.Aspire/WireMockHealthCheck.cs
Author
Owner

@Allen0117 commented on GitHub (Dec 23, 2025):

We did observe flaky test results—sometimes passing and sometimes failing. Therefore, I’d like to confirm whether we should use an existing HealthAsync method or implement our own health-check mechanism.

@Allen0117 commented on GitHub (Dec 23, 2025): We did observe flaky test results—sometimes passing and sometimes failing. Therefore, I’d like to confirm whether we should use an existing HealthAsync method or implement our own health-check mechanism.
Author
Owner

@StefH commented on GitHub (Dec 23, 2025):

@Allen0117
I'm try to add the health check (https://github.com/wiremock/WireMock.Net/pull/1405)...

But you can also build your own Health check.

@StefH commented on GitHub (Dec 23, 2025): @Allen0117 I'm try to add the health check (https://github.com/wiremock/WireMock.Net/pull/1405)... But you can also build your own Health check.
Author
Owner

@Allen0117 commented on GitHub (Dec 24, 2025):

I’d like to share the WaitStrategy approach I implemented with you. After adding it, the error no longer occurs, no matter how many times I try.

.WithWaitStrategy(
    Wait.ForUnixContainer()
        .UntilHttpRequestIsSucceeded(r => r
            .ForPort(1081)
            .WithMethod(HttpMethod.Get)
            .ForPath("/__admin/health")
            .ForStatusCode(HttpStatusCode.OK)
        )
)
@Allen0117 commented on GitHub (Dec 24, 2025): I’d like to share the WaitStrategy approach I implemented with you. After adding it, the error no longer occurs, no matter how many times I try. ```C# .WithWaitStrategy( Wait.ForUnixContainer() .UntilHttpRequestIsSucceeded(r => r .ForPort(1081) .WithMethod(HttpMethod.Get) .ForPath("/__admin/health") .ForStatusCode(HttpStatusCode.OK) ) ) ```
Author
Owner

@StefH commented on GitHub (Dec 24, 2025):

Note that if you defined basic-auth on wiremock server, you need to update this.

@StefH commented on GitHub (Dec 24, 2025): Note that if you defined basic-auth on wiremock server, you need to update this.
Author
Owner

@Allen0117 commented on GitHub (Dec 24, 2025):

"you need to update this." => Does this mean that I need to update this conversation thread (the issue discussion)?

@Allen0117 commented on GitHub (Dec 24, 2025): "you need to update this." => Does this mean that I need to update this conversation thread (the issue discussion)?
Author
Owner

@StefH commented on GitHub (Dec 24, 2025):

No I mean that you need WithBasicAuthentication if you have username + password set in the server.

 .UntilHttpRequestIsSucceeded(httpWaitStrategy => httpWaitStrategy
     .ForPort(WireMockContainer.ContainerPort)
     .WithMethod(HttpMethod.Get)
     .WithBasicAuthentication("user", " pwd")
     .ForPath("/__admin/health")
     .ForStatusCode(HttpStatusCode.OK)
     .ForResponseMessageMatching(async httpResponseMessage =>
     {
         var content = await httpResponseMessage.Content.ReadAsStringAsync();
         return content?.Contains("Healthy") == true;
     })
 )

Note that I've added this logic in the code, so you probably don't need this to build yourself when a new version is released.

@StefH commented on GitHub (Dec 24, 2025): No I mean that you need WithBasicAuthentication if you have username + password set in the server. ``` c# .UntilHttpRequestIsSucceeded(httpWaitStrategy => httpWaitStrategy .ForPort(WireMockContainer.ContainerPort) .WithMethod(HttpMethod.Get) .WithBasicAuthentication("user", " pwd") .ForPath("/__admin/health") .ForStatusCode(HttpStatusCode.OK) .ForResponseMessageMatching(async httpResponseMessage => { var content = await httpResponseMessage.Content.ReadAsStringAsync(); return content?.Contains("Healthy") == true; }) ) ``` --- Note that I've added this logic in the code, so you probably don't need this to build yourself when a new version is released.
Author
Owner

@StefH commented on GitHub (Dec 25, 2025):

https://github.com/wiremock/WireMock.Net/pull/1408

@StefH commented on GitHub (Dec 25, 2025): https://github.com/wiremock/WireMock.Net/pull/1408
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#737