public async Task Authenticate_Connection()
        {
            var options = ClusterFixture.GetClusterOptions();

            options.WithConnectionString(ClusterFixture.GetSettings().ConnectionString);

            var ipEndPointService = new IpEndPointService(
                new DnsClientDnsResolver(new LookupClient(), new DotNetDnsClient(), new Mock <ILogger <DnsClientDnsResolver> >().Object));
            var factory = new ConnectionFactory(options, ipEndPointService,
                                                new Mock <ILogger <MultiplexingConnection> >().Object,
                                                new Mock <ILogger <SslConnection> >().Object);

            var endPoint = options.ConnectionStringValue.GetBootstrapEndpoints().First();

            var connection = await factory
                             .CreateAndConnectAsync(endPoint)
                             .ConfigureAwait(false);

            var sha1Mechanism = new ScramShaMechanism(MechanismType.ScramSha1, options.Password,
                                                      options.UserName, new Mock <ILogger <ScramShaMechanism> >().Object, NoopRequestTracer.Instance,
                                                      new OperationConfigurator(new JsonTranscoder(), Mock.Of <IOperationCompressor>(),
                                                                                new DefaultObjectPool <OperationBuilder>(new OperationBuilderPoolPolicy()),
                                                                                new BestEffortRetryStrategy()));

            await sha1Mechanism.AuthenticateAsync(connection).ConfigureAwait(false);
        }
Beispiel #2
0
        public async Task Authenticate_Connection()
        {
            var options = ClusterFixture.GetClusterOptions();

            options.ConnectionString(ClusterFixture.GetSettings().ConnectionString);

            var factory = new ConnectionFactory(options, new Mock <ILogger <MultiplexingConnection> >().Object,
                                                new Mock <ILogger <SslConnection> >().Object);

            var connection = await factory
                             .CreateAndConnectAsync(options.ServersValue.First().GetIpEndPoint(11210, false))
                             .ConfigureAwait(false);

            var sha1Mechanism = new ScramShaMechanism(new LegacyTranscoder(), MechanismType.ScramSha1, options.Password,
                                                      options.UserName, new Mock <ILogger <ScramShaMechanism> >().Object);

            await sha1Mechanism.AuthenticateAsync(connection).ConfigureAwait(false);
        }
        public async Task Authenticate_Connection()
        {
            var options = ClusterFixture.GetClusterOptions();

            options.WithConnectionString(ClusterFixture.GetSettings().ConnectionString);

            var factory = new ConnectionFactory(options, new Mock <ILogger <MultiplexingConnection> >().Object,
                                                new Mock <ILogger <SslConnection> >().Object);

            var ipEndPointService = new IpEndPointService(
                new DnsClientDnsResolver(new LookupClient(), new Mock <ILogger <DnsClientDnsResolver> >().Object),
                options);
            var ipEndPoint = await ipEndPointService.GetIpEndPointAsync(
                options.ConnectionStringValue.GetBootstrapEndpoints().First().Host, 11210);

            var connection = await factory
                             .CreateAndConnectAsync(ipEndPoint)
                             .ConfigureAwait(false);

            var sha1Mechanism = new ScramShaMechanism(new LegacyTranscoder(), MechanismType.ScramSha1, options.Password,
                                                      options.UserName, new Mock <ILogger <ScramShaMechanism> >().Object);

            await sha1Mechanism.AuthenticateAsync(connection).ConfigureAwait(false);
        }