Пример #1
0
 /// <summary>
 /// Initializes a new <see cref="GloutonServerMock"/>.
 /// </summary>
 /// <param name="boundIpAddress">Host address. You can use <see cref="TestHelper.DefaultHost"/>.</param>
 /// <param name="port">Port. You can use <see cref="TestHelper.DefaultPort"/>.</param>
 /// <param name="clientAuthorizationHandler">Authorization Handler. If none are set, <see cref="TestAuthHandler"/> will be used.</param>
 /// <param name="serverCertificate">Server certificate. Can be null.</param>
 /// <param name="userCertificateValidationCallback">User certification call back. Can be null.</param>
 public GloutonServerMock(
     string boundIpAddress,
     int port,
     IAuthorizationHandler clientAuthorizationHandler = null,
     X509Certificate2 serverCertificate = null,
     RemoteCertificateValidationCallback userCertificateValidationCallback = null)
 {
     _controlChannelServer = new ControlChannelServer
                             (
         boundIpAddress,
         port,
         clientAuthorizationHandler ?? new TestAuthHandler(_ => true),
         serverCertificate,
         userCertificateValidationCallback
                             );
     _controlChannelServer.RegisterChannelHandler("GrandOutputEventInfo", HandleGrandOutputEventInfo);
     _memoryStream = new MemoryStream();
     _binaryReader = new CKBinaryReader(_memoryStream, Encoding.UTF8, true);
     ListLog       = new List <ILogEntry>();
 }
Пример #2
0
 public GloutonServer(
     string boundIpAddress,
     int port,
     IActivityMonitor activityMonitor,
     IAuthorizationHandler clientAuthorizationHandler = null,
     X509Certificate2 serverCertificate = null,
     RemoteCertificateValidationCallback userCertificateValidationCallback = null
     )
 {
     _controlChannelServer = new ControlChannelServer
                             (
         boundIpAddress,
         port,
         clientAuthorizationHandler ?? new TcpAuthorizationHandler(),
         serverCertificate,
         userCertificateValidationCallback
                             );
     _controlChannelServer.RegisterChannelHandler("GrandOutputEventInfo", HandleGrandOutputEventInfo);
     _controlChannelServer.RegisterChannelHandler("AddAlertSender", AddAlertSender);
     _activityMonitor = activityMonitor;
     _handlersManager = new HandlersManager(_activityMonitor);
     _memoryStream    = new MemoryStream();
     _formatter       = new BinaryFormatter();
 }