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