Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
[InlineData(15)]
public async Task LargeSingleHeader_ThrowsException(int maxResponseHeadersLength)
{
var semaphore = new SemaphoreSlim(0);
using var ce = new CountdownEvent(2);
using HttpClientHandler handler = CreateHttpClientHandler();
handler.MaxResponseHeadersLength = maxResponseHeadersLength;

Expand All @@ -86,7 +86,8 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
{
Assert.Contains((handler.MaxResponseHeadersLength * 1024).ToString(), e.ToString());
}
await semaphore.WaitAsync();
ce.Signal();
ce.Wait(TestHelper.PassingTestTimeout);
},
async server =>
{
Expand All @@ -105,7 +106,8 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
#endif
finally
{
semaphore.Release();
ce.Signal();
ce.Wait(TestHelper.PassingTestTimeout);
await connection.DisposeAsync();
}
});
Expand All @@ -119,7 +121,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
[InlineData(int.MaxValue / 800, 100 * 1024)] // Capped at int.MaxValue
public async Task ThresholdExceeded_ThrowsException(int? maxResponseHeadersLength, int headersLengthEstimate)
{
var semaphore = new SemaphoreSlim(0);
using var ce = new CountdownEvent(2);
await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
{
using HttpClientHandler handler = CreateHttpClientHandler();
Expand All @@ -143,7 +145,8 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
Assert.Contains((handler.MaxResponseHeadersLength * 1024).ToString(), e.ToString());
}
}
await semaphore.WaitAsync();
ce.Signal();
ce.Wait(TestHelper.PassingTestTimeout);
},
async server =>
{
Expand All @@ -168,7 +171,8 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
#endif
finally
{
semaphore.Release();
ce.Signal();
ce.Wait(TestHelper.PassingTestTimeout);
await connection.DisposeAsync();
}
});
Expand Down
Loading