Initialize() public method

Prepare the stream for reading and writing
public Initialize ( ) : void
return void
コード例 #1
0
 public void ConnectionTest()
 {
     var comm = new TcpClientCommunicator("127.0.0.1", 3001);
     comm.Initialize();
     Assert.IsTrue(comm.Connected);
     comm.Close();
     Assert.IsFalse(comm.Connected);
 }
コード例 #2
0
 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);
 }
コード例 #4
0
 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);
 }