public void SetUp() { // At some point, I stopped considering this setup easy server = new FlowServer(LazyOptions) .UsingModule(new TcpModule(LocalAddress, Port1)) .UsingWrapper(new Utf8DataWrapper()) .Start(); var manualReset = new ManualResetEvent(false); for (var i = 0; i < destinationClients.Length; i++) { var index = i; void add(DestinationClient client) { destinationClients[index] = client; manualReset.Set(); } server.ClientConnected += add; clients[index] = new FlowClient(LocalAddress, Port1) .UsingWrapper(new Utf8DataWrapper()); clients[index].Connect(); manualReset.WaitOne(); manualReset.Reset(); server.ClientConnected -= add; } }
public void Send(int deviceType) { client = new FlowClient(deviceType); user = new FlowUser(Config.userId); CommandProcessor.sendCommand(this); }
public static void Start(int port) { Console.WriteLine("Press any key to connect"); Console.ReadKey(); client = new FlowClient(IPAddress.Parse("127.0.0.1"), port, options); client.Bind <UserMessage>((int)ScEventId.SendUserMessage, ReceiveMessage); client.Connect(); SendMyName(); ReadAndSend(); }
public void Send(FlowTObject transformToSend) { transformToSend.Read(); obj = new FlowTObject(); obj.Copy(transformToSend); project = new FlowProject(Config.projectId); client = new FlowClient(Config.deviceId); CommandProcessor.sendCommand(this); }
public void Client_ShouldBeEventOnClientConnected() { client = new FlowClient(LocalAddress, Port1); var wasCalled = false; client.Connected += destinationClient => wasCalled = true; client.Connect(); Assert.IsTrue(wasCalled); }
public void Send(string id) { obj = new FlowTObject(); obj._id = id; project = new FlowProject(); project._id = Config.projectId; client = new FlowClient(); client._id = Config.deviceId; CommandProcessor.sendCommand(this); }
public void Server_ShouldBeEventOnClientConnected() { client = new FlowClient(LocalAddress, Port1); var wasCalled = false; server.ClientConnected += destinationClient => wasCalled = true; client.Connect(); // Wait while server accept client Thread.Sleep(MillisecondsToWaitForTransfer); Assert.IsTrue(wasCalled); }