Esempio n. 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);
     }
 }
Esempio n. 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));
     }
 }
Esempio n. 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);
            }
        }
Esempio n. 4
0
 public override GenericLoopbackServer CreateServer(GenericLoopbackOptions options = null)
 {
     return(HttpAgnosticLoopbackServer.CreateServer(CreateOptions(options)));
 }