public void StartListening(MethodInfo method, Type channel, string channelHandlerId, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ChannelMethodHandler methodHandler = new ChannelMethodHandler(_services, channel, method, _settings, _baseURL, channelHandlerId); if (_basicAuthenticationMethod != null) { methodHandler.SetupBasicAuth(_basicAuthenticationMethod); } if (_tokenAuthenticationMethod != null) { methodHandler.SetupTokenAuth(_tokenAuthenticationMethod); } methodHandler.IsServerManaged(_isManaged); //lock the list for safety lock (_lock) { _methodHandlers.AddHandler(methodHandler); } methodHandler.Start(); }