internal NextCallerPlatformClient(IHttpTransport httpTransport) : base(httpTransport) { platformUrl = baseUrl + Properties.Resources.PlatformPath; accountIdHeaderName = Properties.Resources.AccountIdHeaderName; accountIdParameterName = Properties.Resources.AccountIdParameterName; pageParameterName = Properties.Resources.PageParameterName; }
/// <summary> /// Initializes NextCaller client instance. /// </summary> /// <param name="username"> Username for authorization.</param> /// <param name="password"> Password for authorization.</param> /// <param name="sandbox"> Sandbox mode flag.</param> public NextCallerClient(string username, string password, bool sandbox = false) : this(sandbox) { Utility.EnsureParameterValid(!(username == null), "username"); Utility.EnsureParameterValid(!(password == null), "password"); httpTransport = new HttpTransport(username, password); }
/// <summary> /// Initializes a new instance of the <see cref="BasicConnector"/> class. /// </summary> /// <param name="httpTransport"> /// The http transport. /// </param> /// <param name="digest"> /// The digest. /// </param> /// <param name="secret"> /// The secret. /// </param> public BasicConnector(IHttpTransport httpTransport, Digest digest, string secret) { this.httpTransport = httpTransport; this.digest = digest; this.secret = secret; UserAgent = new UserAgent(); }
internal NextCallerPlatformClient(IHttpTransport httpTransport) : base(httpTransport) { platformUrl = baseUrl + Properties.Resources.PlatformPath; accountIdHeaderName = Properties.Resources.AccountIdHeaderName; accountIdParameterName = Properties.Resources.AccountIdParameterName; pageParameterName = Properties.Resources.PageParameterName; }
/// <summary> /// Initializes NextCaller client instance. /// </summary> /// <param name="username"> Username for authorization.</param> /// <param name="password"> Password for authorization.</param> /// <param name="sandbox"> Sandbox mode flag.</param> public NextCallerClient(string username, string password, bool sandbox = false) : this(sandbox) { Utility.EnsureParameterValid(!(username == null), "username"); Utility.EnsureParameterValid(!(password == null), "password"); httpTransport = new HttpTransport(username, password); }
protected TransportTestsBase() { ILog log = new ConsoleLog(); Transport = ClusterClientConfigurationHelper.CreateTransport(log); ThreadPoolUtility.Setup(log); }
private void Dispose(bool disposing) { if (disposing) { if (m_transport != null) { m_transport.Dispose(); m_transport = null; } } }
private async Task DoPersistentConnection(ConnectionDelegate connectionDelegate, IHttpTransport transport, HttpContext context, HttpConnectionContext connection) { if (connection.TryActivatePersistentConnection(connectionDelegate, transport, context, _logger)) { // Wait for any of them to end await Task.WhenAny(connection.ApplicationTask !, connection.TransportTask !); await _manager.DisposeAndRemoveAsync(connection, closeGracefully : true); } }
private async Task DoPersistentConnection(ConnectionDelegate connectionDelegate, IHttpTransport transport, HttpContext context, HttpConnectionContext connection) { await connection.StateLock.WaitAsync(); try { if (connection.Status == HttpConnectionStatus.Disposed) { Log.ConnectionDisposed(_logger, connection.ConnectionId); // Connection was disposed context.Response.StatusCode = StatusCodes.Status404NotFound; return; } // There's already an active request if (connection.Status == HttpConnectionStatus.Active) { Log.ConnectionAlreadyActive(_logger, connection.ConnectionId, connection.GetHttpContext().TraceIdentifier); // Reject the request with a 409 conflict context.Response.StatusCode = StatusCodes.Status409Conflict; return; } // Mark the connection as active connection.Status = HttpConnectionStatus.Active; // Call into the end point passing the connection connection.ApplicationTask = ExecuteApplication(connectionDelegate, connection); // Start the transport connection.TransportTask = transport.ProcessRequestAsync(context, context.RequestAborted); } finally { connection.StateLock.Release(); } // Wait for any of them to end await Task.WhenAny(connection.ApplicationTask, connection.TransportTask); await _manager.DisposeAndRemoveAsync(connection, closeGracefully : true); }
public HealthVaultClient( AppInfo appInfo, ServiceInfo serviceInfo, IHttpTransport transport, IHttpStreamer streamer, ICryptographer cryptographer, bool useOnlineAuthModel, IWebAuthorizer authorizer) { appInfo.ValidateRequired("appInfo"); serviceInfo.ValidateRequired("serviceInfo"); if (transport == null) { throw new ArgumentNullException("transport"); } if (streamer == null) { throw new ArgumentNullException("streamer"); } if (cryptographer == null) { throw new ArgumentNullException("cryptographer"); } if (!useOnlineAuthModel && authorizer == null) { throw new ArgumentNullException("authorizer"); } UseOnlineAuthModel = useOnlineAuthModel; m_appInfo = appInfo; m_serviceInfo = serviceInfo; m_transport = transport; m_streamer = streamer; m_cryptographer = cryptographer; m_authorizer = authorizer; m_serviceMethods = new ServiceMethods(this); m_recordMethods = new RecordMethods(this); m_shell = new Shell(this); m_secretStore = new SecretStore(MakeStoreName(m_appInfo.MasterAppId)); m_state = new ClientState(); LoadState(); }
public HealthVaultClient( AppInfo appInfo, ServiceInfo serviceInfo, IHttpTransport transport, IHttpStreamer streamer, ICryptographer cryptographer, IWebAuthorizer authorizer) { appInfo.ValidateRequired("appInfo"); serviceInfo.ValidateRequired("serviceInfo"); if (transport == null) { throw new ArgumentNullException("transport"); } if (streamer == null) { throw new ArgumentNullException("streamer"); } if (cryptographer == null) { throw new ArgumentNullException("cryptographer"); } if (authorizer == null) { throw new ArgumentNullException("authorizer"); } m_appInfo = appInfo; m_serviceInfo = serviceInfo; m_transport = transport; m_streamer = streamer; m_cryptographer = cryptographer; m_authorizer = authorizer; m_serviceMethods = new ServiceMethods(this); m_recordMethods = new RecordMethods(this); m_shell = new Shell(this); m_secretStore = new SecretStore(MakeStoreName(m_appInfo.MasterAppId)); m_state = new ClientState(); LoadState(); }
private static async Task DoPersistentConnection(EndPoint endpoint, IHttpTransport transport, HttpContext context, Connection connection) { // Register this transport for disconnect RegisterDisconnect(context, connection); // Start the transport var transportTask = transport.ProcessRequestAsync(context); // Call into the end point passing the connection var endpointTask = endpoint.OnConnectedAsync(connection); // Wait for any of them to end await Task.WhenAny(endpointTask, transportTask); // Kill the channel connection.Channel.Dispose(); // Wait for both await Task.WhenAll(endpointTask, transportTask); }
public Client(string apiKey, IHttpTransport transport) { _apiKey = apiKey; _transport = transport; }
internal NextCallerClient(IHttpTransport httpTransport) : this() { this.httpTransport = httpTransport; }
public HttpRetry(IHttpTransport transport, ILoginManager loginMan) : this(transport, loginMan, 5) { }
private void Dispose(bool disposing) { if (disposing) { if (m_transport != null) { m_transport.Dispose(); m_transport = null; } } }
public HttpRetry(IHttpTransport transport, ILoginManager loginMan, int tries) { this.transport = transport; this.loginMan = loginMan; this.maxTries = tries; }
public UpdateController(IHttpTransport httpTransport) { this.httpTransport = httpTransport; }
internal NextCallerClient(IHttpTransport httpTransport) : this() { this.httpTransport = httpTransport; }
public InterceptingHttpTransport(IHttpTransport actual, SdkConfiguration configuration) { _actual = actual; _configuration = configuration; }