private async Task CreateStreamingServerConnectionAsync(Func <ITurnContext, Exception, Task> onTurnError, List <Builder.IMiddleware> middlewareSet, HttpContext httpContext)
        {
            var handler = new StreamingRequestHandler(onTurnError, httpContext.RequestServices, middlewareSet);
            var socket  = await httpContext.WebSockets.AcceptWebSocketAsync().ConfigureAwait(false);

            try
            {
                await handler.StartAsync(socket).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                httpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                await httpContext.Response.WriteAsync("Unable to create transport server.").ConfigureAwait(false);

                throw ex;
            }
        }
 private void StartServer(StreamingRequestHandler handler)
 {
     try
     {
         Task.Run(() => handler.StartAsync(_pipeName));
     }
     catch (Exception ex)
     {
         /* The inability to establish a named pipe connection is not a terminal condition,
          * and should not interrupt the bot's initialization sequence. We log the failure
          * as informative but do not throw an exception or cause a disruption to the bot,
          * as either would require developers to spend time and effort on a feature they
          * may not care about or intend to make use of.
          * As our support for named pipe bots evolves we will likely be able to restrict
          * connection attempts to when they're likely to succeed, but for now it's possible
          * a bot will check for a named pipe connection, find that one does not exist, and
          * simply continue to serve as an HTTP and/or WebSocket bot, none the wiser.
          */
         _logger.LogInformation(string.Format("Failed to create server: {0}", ex));
     }
 }