Beispiel #1
0
 public ImapSession(
     [NotNull] SecurableConnection connection,
     [NotNull] IIndex <string, Meta <Lazy <Owned <IImapCommand> >, ImapCommandMetadata> > commands,
     ILogger logger)
 {
     _commands   = commands ?? throw new ArgumentNullException(nameof(commands));
     _connection = connection ?? throw new ArgumentNullException(nameof(connection));
     _logger     = logger;
     State       = SessionState.Open;
 }
 public BinaryDataCommand(
     SecurableConnection connection,
     SmtpSession session,
     IMailQueue mailQueue,
     IMailBuilder builder)
 {
     _connection = connection;
     _session    = session;
     _mailQueue  = mailQueue;
     _builder    = builder;
 }
Beispiel #3
0
 protected override SmtpSession InitiateSession(SecurableConnection connection, EndPoint local, EndPoint remote)
 {
     return(new SmtpSession(
                connection,
                ImplementationFactory,
                Settings,
                ((IPEndPoint)local).Address.ToString(),
                ((IPEndPoint)remote).Address.ToString(),
                MailStore,
                UserStore));
 }
Beispiel #4
0
 public SmtpSession(
     SecurableConnection connection,
     AgentSettings settings,
     ConnectionInformation connectionInfo,
     IComponentContext context,
     ILogger log)
 {
     _context    = context;
     _log        = log;
     _connection = connection;
     _settings   = settings;
     Id          = $"SMTP {connectionInfo.RemoteAddress}";
 }
Beispiel #5
0
            public TestConnection(ITestOutputHelper output)
            {
                (Stream a, Stream b) = PairedStream.Create();
                LocalStream          = new RedirectableStream(a);
                Reader = new StreamReader(LocalStream);
                Writer = new StreamWriter(LocalStream)
                {
                    AutoFlush = true
                };


                var builder = new ContainerBuilder();

                builder.RegisterAssemblyTypes(typeof(SmtpSession).GetTypeInfo().Assembly)
                .Where(t => t.GetTypeInfo().GetCustomAttribute <SmtpCommandAttribute>() != null)
                .Keyed <ISmtpCommand>(t => t.GetTypeInfo().GetCustomAttribute <SmtpCommandAttribute>().Name);
                builder.RegisterInstance(TestHelpers.MakeSettings("test.vaettir.net"))
                .As <AgentSettings>()
                .As <AgentSettings>();

                builder.RegisterType <SmtpSession>()
                .As <SmtpSession>()
                .As <ISmtpMessageChannel>()
                .As <IMailBuilder>()
                .As <IProtocolSession>();
                builder.RegisterType <SmtpAuthenticationTransport>()
                .As <IAuthenticationTransport>();

                builder.RegisterInstance(new SecurableConnection(b, PrivateKeyHolder.Fixed(s_serverCert)))
                .As <IConnectionSecurity>()
                .As <SecurableConnection>();

                builder.RegisterInstance(new TestOutputLogger(output))
                .As <ILogger>();

                builder.RegisterInstance(new ConnectionInformation("127.0.0.1", "128.0.0.1"));

                Container = builder.Build();

                Connection = Container.Resolve <SecurableConnection>();
                Session    = Container.Resolve <SmtpSession>();

                CancellationTokenSource = new CancellationTokenSource();
                CancellationToken token = CancellationTokenSource.Token;

                SessionTask = Task.Run(() => Session.RunAsync(token), token);
            }
Beispiel #6
0
 public SmtpSession(
     SecurableConnection connection,
     SmtpImplementationFactory implementationFactory,
     SmtpSettings settings,
     string ipAddress,
     string connectedIpAddress,
     IMailStore mailStore,
     IUserStore userStore)
 {
     Connection            = connection;
     ImplementationFactory = implementationFactory;
     Settings           = settings;
     IpAddress          = ipAddress;
     ConnectedIpAddress = connectedIpAddress;
     MailStore          = mailStore;
     UserStore          = userStore;
 }
Beispiel #7
0
 public StartTlsCommand(ISmtpMessageChannel channel, SecurableConnection connection)
 {
     _channel    = channel;
     _connection = connection;
 }
Beispiel #8
0
 public StartTlsCommand(SecurableConnection connection, IImapMessageChannel channel)
 {
     _connection = connection;
     _channel    = channel;
 }