private void OneTimeSetup()
        {
            _channelLocator          = _services.Get <IChannelLocator>();
            _channelMethodDescriptor = _services.Get <IChannelMethodDescriptor>();
            _requestActivator        = _services.Get <IChannelMethodRequestActivator>();
            _msgService            = _services.Get <IChannelMessageService>();
            _contextProvider       = _services.Get <IChannelMethodContextProvider>();
            _configuration         = _services.Get <IChannelConfiguration>();
            _authenticationService = _services.Get <IChannelAuthenticationService>();
            _heuristics            = _services.Get <IChannelHeuristics>();

            Debug.Assert(_channelLocator != null);
            Debug.Assert(_channelMethodDescriptor != null);
            Debug.Assert(_requestActivator != null);
            Debug.Assert(_msgService != null);
            Debug.Assert(_contextProvider != null);
            Debug.Assert(_configuration != null);
            Debug.Assert(_authenticationService != null);
            Debug.Assert(_heuristics != null);

            _rootPath = (new FileInfo(AppDomain.CurrentDomain.BaseDirectory)).Directory.Parent.Parent.Parent.FullName;
            DirectoryInfo logsDirectory = new DirectoryInfo(Path.Combine(_rootPath, "Logs"));

            if (!Directory.Exists(logsDirectory.FullName))
            {
                logsDirectory.Create();
            }

            _sessionKeys = new List <Cookie>();
        }
        public ChannelMethodHandler(IServiceLocator services, Type channel, MethodInfo method, AuthenticationSettings settings, string baseURL, string channelHandlerId)
        {
            _services  = services ?? throw new ArgumentNullException(nameof(services));
            _method    = method ?? throw new ArgumentNullException(nameof(method));
            _channel   = channel ?? throw new ArgumentNullException(nameof(channel));
            _settings  = settings;
            _baseURL   = baseURL;
            _isManaged = false;

            _channelMethodDescriptor = _services.Get <IChannelMethodDescriptor>();
            _requestActivator        = _services.Get <IChannelMethodRequestActivator>();
            _msgService            = _services.Get <IChannelMessageService>();
            _contextProvider       = _services.Get <IChannelMethodContextProvider>();
            _configuration         = _services.Get <IChannelConfiguration>();
            _authenticationService = _services.Get <IChannelAuthenticationService>();
            _heuristics            = _services.Get <IChannelHeuristics>();
            _session = _services.Get <ISessionService>();

            HandlerId        = $"{Guid.NewGuid()}";
            ChannelHandlerId = channelHandlerId;

            _isDisposed = false;
            _safeHandle = new SafeFileHandle(IntPtr.Zero, true);
        }
 public ChannelMethodCaller(IChannelMessageService msgService, IChannelMethodContextProvider contextProvider, IChannelMethodRequestActivator requestActivator)
 {
     _contextProvider  = contextProvider;
     _requestActivator = requestActivator;
     _msgService       = msgService;
 }