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(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); }
public void Setup() { Server = new TcpAppServer(); Server.Start(12500); System.Threading.Thread.Sleep(1000); Client = new TcpAppClient("127.0.0.1", 12500); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { Client.Dispose(); Client = null; appClient.Dispose(); appClient = null; }
public void MathPlugin_CommandTimeout() { TcpAppClient newClient = new TcpAppClient("127.0.0.1", 25000); newClient.Connect(); TcpAppCommandResult result = newClient.ExecuteCommand("CreatePlugin simplemath M2"); Assert.AreEqual(TcpAppCommandStatus.OK, result.Status); Assert.Throws <TcpAppClientException>(() => { newClient.ExecuteCommand("M2 TimeoutSim"); }); }
public void SignInDualClient() { Client.Connect(); TcpAppClient Client2 = new TcpAppClient("localhost", 25000); Client2.Connect(); TestContext.Progress.WriteLine("Client ConnectionID = " + Client.ConnectionID); TestContext.Progress.WriteLine("Client2 ConnectionID = " + Client2.ConnectionID); Assert.AreNotEqual(Client.ConnectionID, Client2.ConnectionID); }
public MainForm() { InitializeComponent(); PnSendCommand.Enabled = false; Client = new TcpAppClient(); Client.ConnectionStatusChanged += Client_ConnectionStatusChanged; Client.ResponseReceived += Client_ResponseReceived; Client.CommandSend += Client_CommandSend; TerminalOutput.Clear(); }
public Form1() { InitializeComponent(); Client = new TcpClient(); appClient = new TcpAppClient(); appClient.CommandSend += AppClient_CommandSend; appClient.ResponseReceived += AppClient_ResponseReceived; Client.HostName = "127.0.0.1"; Client.Port = 1000; Client.DataReceived += Client_DataReceived; Client.ConnectionStatusChanged += Client_ConnectionStatusChanged; propertyGrid1.SelectedObject = Client; btWrite.Enabled = false; }
public MainForm() { InitializeComponent(); PnSendCommand.Enabled = false; AppClient = new TcpAppClient(); AppClient.ConnectionStatusChanged += Client_ConnectionStatusChanged; AppClient.ResponseReceived += Client_ResponseReceived; AppClient.CommandSend += Client_CommandSend; TcpClient = new TcpClient(); TcpClient.ConnectionStatusChanged += Client_ConnectionStatusChanged; TcpClient.DataReceived += TcpClient_DataReceived; CbClientType.SelectedIndex = 0; TerminalOutput.Clear(); }
public void Client3Execution() { TcpAppClient client = new TcpAppClient("localhost", 25000); client.Connect(); for (int x = 0; x < 10; x++) { if (client.ExecuteCommand("Delay C3 80").Status == TcpAppCommandStatus.ERR) { TestContext.Progress.WriteLine("C3 Terminated on Error!"); Assert.Fail(); break; } } while (!C3ThreadAbort) { client.ExecuteCommand("CheckStatus"); Thread.Sleep(5000); } }
public void TearDown() { Server.Dispose(); Server = null; Client.Dispose(); Client = null; Debug.WriteLine("Fixture Tear Down Completed."); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { ptrClient = null; AppClient.Dispose(); AppClient = null; TcpClient.Dispose(); TcpClient = null; }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { Client.Dispose(); Client = null; }