public static async Task CreateServerAsync(Func <HttpAgnosticLoopbackServer, Uri, Task> funcAsync, int millisecondsTimeout = 60_000) { using (var server = HttpAgnosticLoopbackServer.CreateServer()) { await funcAsync(server, server.Address).WaitAsync(TimeSpan.FromMilliseconds(millisecondsTimeout)); } }
public static async Task CreateServerAsync(Func <HttpAgnosticLoopbackServer, Uri, Task> funcAsync, int millisecondsTimeout = 60_000) { using (var server = HttpAgnosticLoopbackServer.CreateServer()) { await funcAsync(server, server.Address).TimeoutAfter(millisecondsTimeout).ConfigureAwait(false); } }
public static async Task CreateClientAndServerAsync(Func <Uri, Task> clientFunc, Func <GenericLoopbackServer, Task> serverFunc, HttpAgnosticOptions httpOptions, int timeout = 60_000) { using (var server = HttpAgnosticLoopbackServer.CreateServer(httpOptions ?? new HttpAgnosticOptions())) { Task clientTask = clientFunc(server.Address); Task serverTask = serverFunc(server); await new Task[] { clientTask, serverTask }.WhenAllOrAnyFailed(timeout).ConfigureAwait(false); } }
public override GenericLoopbackServer CreateServer(GenericLoopbackOptions options = null) { return(HttpAgnosticLoopbackServer.CreateServer(CreateOptions(options))); }