public void SetUp(Action <IHttpService> bootstrap = null)
{
_bus = new InMemoryBus($"bus_{_serverEndPoint.Port}");
var pipelineBus = InMemoryBus.CreateTest();
var queue = new QueuedHandlerThreadPool(pipelineBus, "Test", new QueueStatsManager(), true, TimeSpan.FromMilliseconds(50));
_multiQueuedHandler = new MultiQueuedHandler(new IQueuedHandler[] { queue }, null);
_multiQueuedHandler.Start();
_service = new KestrelHttpService(ServiceAccessibility.Private, _bus, new NaiveUriRouter(),
_multiQueuedHandler, false, null, 0, false, _serverEndPoint);
_internalDispatcher = new InternalDispatcherEndpoint(queue, _multiQueuedHandler);
_bus.Subscribe(_internalDispatcher);
KestrelHttpService.CreateAndSubscribePipeline(pipelineBus);
bootstrap?.Invoke(_service);
_server = new TestServer(
new WebHostBuilder()
.UseStartup(new ClusterVNodeStartup(Array.Empty <ISubsystem>(), queue, _bus, _multiQueuedHandler,
new TestAuthenticationProvider(),
new IHttpAuthenticationProvider[] {
new BasicHttpAuthenticationProvider(new TestAuthenticationProvider()),
new AnonymousHttpAuthenticationProvider(),
}, new TestAuthorizationProvider(), new FakeReadIndex(_ => false), 1024 * 1024, _service)));
_httpMessageHandler = _server.CreateHandler();
_client = new HttpAsyncClient(_timeout, _httpMessageHandler);
HttpBootstrap.Subscribe(_bus, _service);
}