Initialize() public method

Prepare the stream for reading and writing
public Initialize ( ) : void
return void
 public void ConnectionTest()
 {
     var comm = new TcpClientCommunicator("127.0.0.1", 3001);
     comm.Initialize();
     Assert.IsTrue(comm.Connected);
     comm.Close();
     Assert.IsFalse(comm.Connected);
 }
 public void MessageTest()
 {
     var comm = new TcpClientCommunicator("127.0.0.1", 3001);
     comm.Initialize();
     var resp = comm.SendMessage<Response>(new GenericMessage<string>("Hello World"));
     Assert.NotNull(resp);
     Assert.IsTrue(resp.Success);
 }
示例#3
0
 public void ResponseTest()
 {
     var comm = new TcpClientCommunicator("127.0.0.1", 3001);
     comm.Initialize();
     var msg = comm.WaitForMessage<GenericMessage<string>>();
     Assert.AreEqual(MSG, msg.Contents);
     comm.SendResponse(msg.CreateResponse(true));
     Thread.Sleep(100);
     Assert.IsTrue(Auto.RecivedResponse);
 }
 public void CallbackTest()
 {
     var comm = new TcpClientCommunicator("127.0.0.1", 3001);
     comm.Initialize();
     comm.SendMessage<Response>(new GenericMessage<string>("Hello World"), resp =>
         {
             Assert.NotNull(resp);
             Assert.IsTrue(resp.Success);
         });
     Thread.Sleep(100);
 }