Пример #1
0
 public void Setup()
 {
     Server = new TcpAppServer(null);
     Server.Start(12500);
     System.Threading.Thread.Sleep(1000);
     Client = new TcpAppClient("localhost", 12500);
 }
 public void Setup()
 {
     Server = new TcpAppServer();
     Server.Start(12500);
     System.Threading.Thread.Sleep(1000);
     Client = new TcpAppClient("127.0.0.1", 12500);
 }
Пример #3
0
        public void Setup()
        {
            Server = new TcpAppServer();
            Server.Start(25000);
            Server.ClientSignedIn   += Server_ClientSignedIn;
            Server.ClientSigningOut += Server_ClientSigningOut;
            Server.RegisterCommand("Custom_1", "Custom Command.", Custom1Callback);
            Server.RegisterQueuedCommand("Delay", "Custom Delay", (TcpAppInputCommand sender) =>
            {
                //Each connection execute command from different thread
                int delay = Convert.ToInt32(sender.Command.Parameter("duration").Value);
                //TestContext.Progress.WriteLine(sender.Command.Parameter("client").Value + " Sleep " + delay.ToString());
                Thread.Sleep(delay);
                sender.Status        = TcpAppCommandStatus.OK;
                sender.OutputMessage = "Delay Tick";
            },
                                         TcpAppParameter.CreateParameter("client", "client name"),
                                         TcpAppParameter.CreateParameter("duration", "Duration in ms"));
            Server.RegisterCommand("DelayNoQueue", "Custom Delay", (TcpAppInputCommand sender) =>
            {
                //Each connection execute command from different thread
                int delay = Convert.ToInt32(sender.Command.Parameter("duration").Value);
                //TestContext.Progress.WriteLine(sender.Command.Parameter("client").Value + " Sleep " + delay.ToString());
                Thread.Sleep(delay);
                sender.Status        = TcpAppCommandStatus.OK;
                sender.OutputMessage = "MAIN";
            },
                                   TcpAppParameter.CreateParameter("client", "client name"),
                                   TcpAppParameter.CreateParameter("duration", "Duration in ms"));
            Server.RegisterPluginType(typeof(TcpAppServerSimpleMath));


            Client = new TcpAppClient("localhost", 25000);
            Tcp    = new TcpClient("localhost", 25000);
        }
Пример #4
0
 public void StartServer()
 {
     using (TcpAppServer server = new TcpAppServer())
     {
         server.Start(25100);
         Assert.IsTrue(server.IsServerStarted);
     }
 }
Пример #5
0
 public void Setup()
 {
     Server.Start(25000);
     System.Threading.Thread.Sleep(100);
     Client.Connect();
     System.Threading.Thread.Sleep(100);
     Assert.AreEqual(1, Server.Clients.Count);
     Debug.WriteLine("Fixture Setup Completed.");
 }
Пример #6
0
 public void Setup()
 {
     Server.Start(25000);
     System.Threading.Thread.Sleep(100);
     Client.Connect();
     System.Threading.Thread.Sleep(100);
     Assert.AreEqual(1, Server.Clients.Count);
     Debug.WriteLine("Fixture Setup Completed.");
     Server.RegisterPluginType("SamplePlugin", typeof(TcpAppServerSamplePlugin));
 }
Пример #7
0
 private void btAppServerStart_Click(object sender, EventArgs e)
 {
     AppServer.Start(Convert.ToInt32(txtAppServerPort.Text));
     propertyGrid2.Refresh();
 }