Beispiel #1
0
 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);
     }
 }
Beispiel #2
0
 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));
     }
 }
Beispiel #3
0
        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);
            }
        }
Beispiel #4
0
 public override GenericLoopbackServer CreateServer(GenericLoopbackOptions options = null)
 {
     return(HttpAgnosticLoopbackServer.CreateServer(CreateOptions(options)));
 }