/// <summary> /// Gets executed once the idle timeout has passed /// </summary> private void IdleTimeoutHandler(object state) { //Ensure there are no more idle timeouts until the query finished sending if (_isCanceled) { if (!IsDisposed) { //If it was not manually disposed Connection.Logger.Warning("Can not issue an heartbeat request as connection is closed"); OnIdleRequestException?.Invoke(new SocketException((int)SocketError.NotConnected)); } return; } Connection.Logger.Verbose("Connection idling, issuing a Request to prevent idle disconnects"); var request = new OptionsRequest(); Send(request, (error, response) => { if (error?.Exception == null) { //The send succeeded //There is a valid response but we don't care about the response return; } Connection.Logger.Warning("Received heartbeat request exception " + error.Exception.ToString()); if (error.Exception is SocketException) { OnIdleRequestException?.Invoke(error.Exception); } }); }
public OptionsResponse GetOptionsByProfile([FromBody] OptionsRequest request) { OptionsResponse response = new OptionsResponse(); MOptions option = new MOptions(); List <MOptions> options = new List <MOptions>(); try { /*METODO QUE VALIDA EL TOKEN DE APLICACIÓN*/ if (!BAplication.ValidateAplicationToken(request.ApplicationToken)) { response.Code = "2"; response.Message = Messages.ApplicationTokenNoAutorize; return(response); } /*************FIN DEL METODO*************/ option.ProfileId = request.Options.ProfileId; int Val = 0; options = BOptions.Sel(option, ref Val); if (Val.Equals(0)) { response.Code = "0"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción response.Message = Messages.Success; } else if (Val.Equals(2)) { response.Code = "2"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción response.Message = String.Format(Messages.ErrorObtainingReults, "options"); } else { response.Code = "1"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción response.Message = String.Format(Messages.NotReults, "options"); } } catch (Exception ex) { response.Code = "2"; //0=> Ëxito | 1=> Validación de Sistema | 2 => Error de Excepción response.Message = ex.Message; } response.Options = options.ToArray(); return(response); }
public async Task ApplySupportedOptionsAsync(IConnection connection) { var request = new OptionsRequest(); var response = await connection.Send(request).ConfigureAwait(false); if (response == null) { throw new NullReferenceException("Response can not be null"); } if (!(response is SupportedResponse supportedResponse)) { throw new DriverInternalError("Expected SupportedResponse, obtained " + response.GetType().FullName); } ApplyProductTypeOption(supportedResponse.Output.Options); }
public void RegisterOptionProvider() { // Arrange var handler = Substitute.For <IOptionProvider>(); var otherOptionsRequest = new OptionsRequest { Name = "other" }; var optionsRequest = new OptionsRequest { Name = "action" }; var sut = Configure(c => c.RegisterOptionProvider("action", handler)); // Act HandleLegacyOptionsRequest(sut, new[] { otherOptionsRequest, optionsRequest }); // Assert handler.DidNotReceive().GetOptions(otherOptionsRequest); handler.Received().GetOptions(optionsRequest); }
private async Task <HttpResponse> HandleLegacyOptionsRequest(HttpContext context, OptionsRequest optionsRequest) { var response = await _slackOptions.Handle(optionsRequest).ConfigureAwait(false); return(await context.Respond(HttpStatusCode.OK, "application/json", Serialize(response)).ConfigureAwait(false)); }
private async Task <SlackResult> HandleLegacyOptionsRequest(OptionsRequest optionsRequest) { var response = await _optionProvider.GetOptions(optionsRequest).ConfigureAwait(false); return(new JsonResult(_jsonSettings, HttpStatusCode.OK, response)); }
public Task <OptionsResponse> GetOptions(OptionsRequest request) => ResolvedHandle(h => h.GetOptions(request));
public async Task <OptionsResponse> GetOptions(OptionsRequest request) => new OptionsResponse { Options = GetOptions(request.Value) };
OptionsResponse IEasConnection.Options(OptionsRequest optionsRequest) { OptionsCommand optionsCommand = new OptionsCommand(this.EasConnectionSettings); return(optionsCommand.Execute(optionsRequest)); }
public abstract void VisitOptionsDescription(OptionsRequest element);
private async Task <SlackResponse> HandleLegacyOptionsRequest(OptionsRequest optionsRequest) { var response = await _slackOptions.Handle(optionsRequest).ConfigureAwait(false); return(new JsonResponse(HttpStatusCode.OK, response)); }
public async Task <OptionsResponse> GetOptions(OptionsRequest request) => new()
OptionsResponse IEasConnection.Options(OptionsRequest optionsRequest) { throw new NotImplementedException(); }
public Task <OptionsResponse> Handle(OptionsRequest request) => _options.Handle(request);
public override Task <OptionsResponse> GetOptions(OptionsRequest request) { var handler = _serviceProvider.GetRequiredService <T>(); return(handler.GetOptions(request)); }
public override void VisitOptionsDescription(OptionsRequest element) => _builder.MapMethods(element.Path, new [] { Options.Method }, RequestDelegate());