public SocketConnection(Uri uri, ConnectionSettings connectionSettings, BufferSettings bufferSettings, ILogger logger = null) { _idPrefix = $"conn-{uri.Host}:{uri.Port}-"; _id = $"{_idPrefix}{UniqueIdGenerator.GetId()}"; _logger = new PrefixLogger(logger, FormatPrefix(_id)); _client = new SocketClient(uri, connectionSettings.SocketSettings, bufferSettings, _logger); _authToken = connectionSettings.AuthToken; _userAgent = connectionSettings.UserAgent; Server = new ServerInfo(uri); _responsePipeline = new ResponsePipeline(_logger); }
public SocketConnection(Uri uri, ConnectionSettings connectionSettings, BufferSettings bufferSettings, IConnectionListener metricsListener = null, IDriverLogger logger = null) { _id = $"conn-{UniqueIdGenerator.GetId()}"; _logger = new PrefixLogger(logger, FormatPrefix(_id)); _client = new SocketClient(uri, connectionSettings.SocketSettings, bufferSettings, metricsListener, _logger); _authToken = connectionSettings.AuthToken; _userAgent = connectionSettings.UserAgent; Server = new ServerInfo(uri); _responseHandler = new MessageResponseHandler(_logger); }
// for test only internal SocketConnection(ISocketClient socketClient, IAuthToken authToken, string userAgent, ILogger logger, IServerInfo server, IResponsePipeline responsePipeline = null) { Throw.ArgumentNullException.IfNull(socketClient, nameof(socketClient)); Throw.ArgumentNullException.IfNull(authToken, nameof(authToken)); Throw.ArgumentNullException.IfNull(userAgent, nameof(userAgent)); Throw.ArgumentNullException.IfNull(server, nameof(server)); _client = socketClient; _authToken = authToken; _userAgent = userAgent; Server = server; _id = $"{_idPrefix}{UniqueIdGenerator.GetId()}"; _logger = new PrefixLogger(logger, FormatPrefix(_id)); _responsePipeline = responsePipeline ?? new ResponsePipeline(logger); }
// for test only internal SocketConnection(ISocketClient socketClient, IAuthToken authToken, string userAgent, IDriverLogger logger, IServerInfo server, IMessageResponseHandler messageResponseHandler = null) { Throw.ArgumentNullException.IfNull(socketClient, nameof(socketClient)); Throw.ArgumentNullException.IfNull(authToken, nameof(authToken)); Throw.ArgumentNullException.IfNull(userAgent, nameof(userAgent)); Throw.ArgumentNullException.IfNull(server, nameof(server)); _client = socketClient; _authToken = authToken; _userAgent = userAgent; Server = server; _id = $"conn-{UniqueIdGenerator.GetId()}"; _logger = new PrefixLogger(logger, FormatPrefix(_id)); _responseHandler = messageResponseHandler ?? new MessageResponseHandler(logger); }