protected override void PreStart()
        {
            base.PreStart();

            _self        = Self;
            _eventStream = Context.System.EventStream;

            // create initial actors and bind them

            if (_initiator.CreateInitialActors != null)
            {
                var actors = _initiator.CreateInitialActors(Context, _connection);
                if (actors != null)
                {
                    foreach (var actor in actors)
                    {
                        BindActor(actor.Item1, actor.Item2.Select(t => new BoundType(t)));
                    }
                }
            }

            // accept it

            _connection.MessageHandler = OnConnectionMessage;
            _connection.Approve();
        }
        protected override void PreStart()
        {
            base.PreStart();

            _self        = Self;
            _eventStream = Context.System.EventStream;

            // create initial actors and bind them

            if (_initiator.CreateInitialActors != null)
            {
                var actors = _initiator.CreateInitialActors(Context, _connection);
                if (actors != null)
                {
                    foreach (var actor in actors)
                    {
                        BindActor(actor.Item1, actor.Item2.Select(t => new BoundType(t)));
                    }
                }
            }

            // link connection to this

            _connection.Closed   += OnConnectionClose;
            _connection.Received += OnConnectionReceive;

            if (_connection.IsOpen == false)
            {
                try
                {
                    _connection.Open();
                }
                catch (Exception e)
                {
                    _logger.ErrorFormat("Cannot open connection.", e);
                }
            }
            else
            {
                if (_connection.Active)
                {
                    _connection.Send(new Packet
                    {
                        Type    = PacketType.System,
                        Message = "1",
                    });
                }
                else
                {
                    OnConnectionClose(_connection, -1);
                }
            }
        }