/// <summary>
        /// To connect. The connection is established automatically when the method <see cref="Invoke"/> or <see cref="Invoke{TService}"/> is called.
        /// </summary>
        public virtual void Connect()
        {
            _factory = ChannelHelper.Create(_endpointName, CreateChannel);

            if (_hasCallbacks)
            {
                _service = _factory.CreateChannel();
            }

            OnConnect();

            IsConnected = true;
        }