示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        // 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);
        }
示例#4
0
        // 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);
        }