public void Connect()
        {
            EventBusForwarder = GetActor(GetSelection(nameof(EventBusForwarder)));

            var transportBridge = new RemoteAkkaEventBusTransport(
                new LocalAkkaEventBusTransport(_consoleSystem),
                EventBusForwarder,
                TimeSpan.FromSeconds(30));

            _commandExecutor = new AkkaCommandExecutor(_consoleSystem, transportBridge);
            _waiterFactory   = new MessageWaiterFactory(_commandExecutor, _consoleSystem, TimeSpan.FromSeconds(30), transportBridge);
        }
        public async Task Connect(int maxRetries = 5, TimeSpan?timeout = null)
        {
            if (_consoleSystem != null)
            {
                return;
            }


            IActorRef eventBusForwarder     = null;
            IActorRef commandExecutionActor = null;
            int       connectionCountLeft   = maxRetries;

            while (true)
            {
                try
                {
                    _consoleSystem = _conf.CreateInMemorySystem();
                    DomainEventsJsonSerializationExtensionProvider.Provider.Apply(_consoleSystem);
                    _logger.Information("Starting association");

                    var data = await GetSelection(nameof(GridNodeController))
                               .Ask <GridNodeController.Connected>(GridNodeController.Connect.Instance, timeout ?? _defaultTimeout);

                    eventBusForwarder     = data.TransportProxy;
                    commandExecutionActor = data.PipeRef;

                    _logger.Information("Association formed");
                    break;
                }
                catch (Exception ex)
                {
                    _consoleSystem?.Dispose();
                    _logger.Warning(ex, "could not get answer from grid node controller in time");
                    if (--connectionCountLeft == 0)
                    {
                        throw;
                    }
                }
            }

            var transportBridge = new RemoteAkkaEventBusTransport(new LocalAkkaEventBusTransport(_consoleSystem),
                                                                  eventBusForwarder,
                                                                  _defaultTimeout);

            _commandExecutor = new AkkaCommandPipeExecutor(_consoleSystem,
                                                           transportBridge,
                                                           commandExecutionActor,
                                                           _defaultTimeout);

            _waiterFactory = new MessageWaiterFactory(_consoleSystem, transportBridge, _defaultTimeout);
        }