コード例 #1
0
 private void ConnectToExistingVm()
 {
     VMHandle handle = null;
     while(handle == null)
     {
         handle = new VMConnectHandle().GetCurrent();
     }
     client = new NetClient(new DebugClientFeedbackProvider());
     client.MessageReceived += ClientMessageReceived;
     client.Connect(handle.IP, handle.Port);
 }
コード例 #2
0
 private void initialize(string ip, int port, int processID, string handle, Action<object> response)
 {
     IP = ip;
     Port = port;
     ProcessID = processID;
     _client = new NetClient(null);
     _client.MessageReceived += new EventHandler<MessageReceivedEventArgs>(_client_MessageReceived);
     _client.Connect(ip, port);
     if (_client.IsConnected)
         _client.Send(new DiagnosticInstanceMessage());
     Handle = handle;
     _reciever = response;
 }
コード例 #3
0
 private bool canConnect(VMHandle handle)
 {
     try
     {
         var client = new NetClient(null);
         client.Connect(handle.IP, handle.Port);
         var isConnected = client.IsConnected;
         if (isConnected)
             client.Disconnect();
         return isConnected;
     }
     catch
     {
     }
     return false;
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: nosami/ContinuousTests
 private static void SendVmTerminatingMessage(ITcpServer server, int port)
 {
     var client = new NetClient(new ClientFeedback());
     client.Connect("127.0.0.1", port);
     client.SendAndWait(new VMTerminating(server.Port));
     client.Disconnect();
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: nosami/ContinuousTests
 private static void SendVmInitializedMessage(Guid correlationId, ITcpServer server, int port)
 {
     var client = new NetClient(new ClientFeedback());
     client.Connect("127.0.0.1", port);
     Logger.WriteDebug(string.Format("About to send VMInitializedMessage for 127.0.0.1:{0}", server.Port));
     client.SendAndWait(new VMInitializedMessage(correlationId, Process.GetCurrentProcess().Id, server.Port, _engine.GetNUnitTestRunner(), _engine.GetMSTestRunner(), _engine.IsLoggingEnabled(), _engine.StartedPaused));
     client.Disconnect();
 }
コード例 #6
0
ファイル: Host.cs プロジェクト: jeroldhaas/ContinuousTests
 private void send(IMessage message)
 {
     if (_host == null)
     {
         _host = new NetClient(this);
         Logger.Write(string.Format("Connectiong to 127.0.0.1:{0}", _port));
         _host.Connect("127.0.0.1", _port);
         _host.MessageReceived += _spawnClient_MessageReceived;
     }
     _host.Send(message);
 }
コード例 #7
0
ファイル: Host.cs プロジェクト: jeroldhaas/ContinuousTests
 private void _spawnClient_MessageReceived(object sender, MessageReceivedEventArgs e)
 {
     Logger.Write(string.Format("Recieving message of type {0} from host", e.Message.GetType()));
     if (e.Message.GetType().Equals(typeof(VMSpawnedMessage)))
     {
         Logger.Write("Recieved VMSpawnedMessage");
         var message = (VMSpawnedMessage)e.Message;
         if (!message.CorrelationId.Equals(_spawnCorrelationID))
             return;
         Logger.Write("Message has correct correlationID");
         _host.Disconnect();
         _host.MessageReceived -= _spawnClient_MessageReceived;
         _host = null;
         Logger.Write(string.Format("Disconnected from 127.0.0.1:{0}", _port));
         if (VMSpawned != null)
             VMSpawned(this, new VMSpawnedArgs(message));
         _spawnHandler.VMStarted(message);
     }
     if (e.Message.GetType().Equals(typeof(ValidLicenseMessage)))
     {
         //throw new NotImplementedException(); WTF was this throwing unimpl exception?!
     }
 }