protected override ConnectorInfoManager GetConnectorInfoManager() { TestUtil.InitializeLogging(); GuardedString str = new GuardedString(); str.AppendChar('c'); str.AppendChar('h'); str.AppendChar('a'); str.AppendChar('n'); str.AppendChar('g'); str.AppendChar('e'); str.AppendChar('i'); str.AppendChar('t'); #if DEBUG const int PORT = 58762; #else const int PORT = 58761; #endif /*X509Store store = new X509Store("TestCertificateStore", * StoreLocation.CurrentUser); * store.Open(OpenFlags.ReadOnly|OpenFlags.OpenExistingOnly); * X509Certificate certificate = store.Certificates[0]; * store.Close();*/ X509Certificate2 certificate = new X509Certificate2(CERT_PATH, "changeit"); //Trace.TraceInformation("certificate: "+certificate); _server = ConnectorServer.NewInstance(); _server.Port = PORT; _server.KeyHash = str.GetBase64SHA1Hash(); _server.IfAddress = (IOUtil.GetIPAddress("localhost")); _server.UseSSL = true; _server.ServerCertificate = certificate; _server.Start(); //while ( true ) { // Thread.Sleep(1000); //} ConnectorInfoManagerFactory fact = ConnectorInfoManagerFactory.GetInstance(); MyCertificateValidationCallback callback = new MyCertificateValidationCallback(); RemoteFrameworkConnectionInfo connInfo = new RemoteFrameworkConnectionInfo("localhost", PORT, str, true, callback.Validate, 60000); ConnectorInfoManager manager = fact.GetRemoteManager(connInfo); return(manager); }
protected override ConnectorInfoManager GetConnectorInfoManager() { TestUtil.InitializeLogging(); GuardedString str = new GuardedString(); str.AppendChar('c'); str.AppendChar('h'); str.AppendChar('a'); str.AppendChar('n'); str.AppendChar('g'); str.AppendChar('e'); str.AppendChar('i'); str.AppendChar('t'); #if DEBUG const int PORT = 58762; #else const int PORT = 58761; #endif /*X509Store store = new X509Store("TestCertificateStore", StoreLocation.CurrentUser); store.Open(OpenFlags.ReadOnly|OpenFlags.OpenExistingOnly); X509Certificate certificate = store.Certificates[0]; store.Close();*/ X509Certificate2 certificate = new X509Certificate2(CERT_PATH, "changeit"); //Trace.TraceInformation("certificate: "+certificate); _server = ConnectorServer.NewInstance(); _server.Port = PORT; _server.KeyHash = str.GetBase64SHA1Hash(); _server.IfAddress = (IOUtil.GetIPAddress("localhost")); _server.UseSSL = true; _server.ServerCertificate = certificate; _server.Start(); //while ( true ) { // Thread.Sleep(1000); //} ConnectorInfoManagerFactory fact = ConnectorInfoManagerFactory.GetInstance(); MyCertificateValidationCallback callback = new MyCertificateValidationCallback(); RemoteFrameworkConnectionInfo connInfo = new RemoteFrameworkConnectionInfo("localhost", PORT, str, true, callback.Validate, 60000); ConnectorInfoManager manager = fact.GetRemoteManager(connInfo); return manager; }