@@ -31,78 +31,7 @@ static void Main(string[] args)
31
31
//ServerCancellingExample.Run();
32
32
//SessionTracingExample.Run();
33
33
//DependencyInjectionExample.Run();
34
- //SecureServerExample.Run();
35
-
36
- //_cancellationTokenSource = new CancellationTokenSource();
37
-
38
- var options = new SmtpServerOptionsBuilder ( )
39
- . ServerName ( "SmtpServer SampleApp" )
40
- . Port ( 9025 )
41
- . Build ( ) ;
42
-
43
- var serviceProvider = new ServiceProvider ( ) ;
44
- serviceProvider . Add ( new SampleMessageStore ( Console . Out ) ) ;
45
-
46
- var server = new SmtpServer . SmtpServer ( options , serviceProvider ) ;
47
-
48
- server . SessionCreated += OnSessionCreated ;
49
- server . SessionCompleted += OnSessionCompleted ;
50
- server . SessionFaulted += OnSessionFaulted ;
51
- server . SessionCancelled += OnSessionCancelled ;
52
-
53
- var serverTask = server . StartAsync ( CancellationToken . None ) ;
54
-
55
- serverTask . WaitWithoutException ( ) ;
56
- }
57
-
58
- static void OnSessionFaulted ( object sender , SessionFaultedEventArgs e )
59
- {
60
- Console . WriteLine ( "SessionFaulted: {0}" , e . Exception ) ;
61
- }
62
-
63
- static void OnSessionCancelled ( object sender , SessionEventArgs e )
64
- {
65
- Console . WriteLine ( "SessionCancelled" ) ;
66
- }
67
-
68
- static void OnSessionCreated ( object sender , SessionEventArgs e )
69
- {
70
- e . Context . Properties . Add ( "SessionID" , Guid . NewGuid ( ) ) ;
71
-
72
- e . Context . CommandExecuting += OnCommandExecuting ;
73
- e . Context . CommandExecuted += OnCommandExecuted ;
74
- e . Context . ResponseException += OnResponseException ;
75
- }
76
-
77
- private static void OnResponseException ( object sender , SmtpResponseExceptionEventArgs e )
78
- {
79
- Console . WriteLine ( "Response Exception" ) ;
80
- if ( e . Exception . Properties . ContainsKey ( "SmtpSession:Buffer" ) )
81
- {
82
- var buffer = e . Exception . Properties [ "SmtpSession:Buffer" ] as byte [ ] ;
83
- Console . WriteLine ( "Unknown Line: {0}" , Encoding . UTF8 . GetString ( buffer ) ) ;
84
- }
85
- }
86
-
87
- static void OnCommandExecuting ( object sender , SmtpCommandEventArgs e )
88
- {
89
- //Console.WriteLine("Command Executing (SessionID={0})", e.Context.Properties["SessionID"]);
90
- new TracingSmtpCommandVisitor ( Console . Out ) . Visit ( e . Command ) ;
91
- }
92
-
93
- static void OnCommandExecuted ( object sender , SmtpCommandEventArgs e )
94
- {
95
- //Console.WriteLine("Command Executed (SessionID={0})", e.Context.Properties["SessionID"]);
96
- //new TracingSmtpCommandVisitor(Console.Out).Visit(e.Command);
97
- }
98
-
99
- static void OnSessionCompleted ( object sender , SessionEventArgs e )
100
- {
101
- Console . WriteLine ( "SessionCompleted: {0}" , e . Context . Properties [ EndpointListener . RemoteEndPointKey ] ) ;
102
-
103
- e . Context . CommandExecuting -= OnCommandExecuting ;
104
- e . Context . CommandExecuted -= OnCommandExecuted ;
105
- e . Context . ResponseException -= OnResponseException ;
34
+ SecureServerExample . Run ( ) ;
106
35
}
107
36
108
37
static bool IgnoreCertificateValidationFailureForTestingOnly ( object sender , X509Certificate certificate , X509Chain chain , SslPolicyErrors sslPolicyErrors )
0 commit comments