public void ConnectTest() { try { wsProtocol.Listen(); WebSocketProtocol ipvClient = this.CreateWSClientProtocol(); var socket = ipvClient.Connect(serverAddress, PORT); Assert.IsTrue(socket.Connected, "A connection could not be established."); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void OnConnectionRequestedTest() { ManualResetEventSlim mevent = new ManualResetEventSlim(false); wsProtocol.Listen(); mevent.Reset(); bool eventInvoked = false; wsProtocol.OnConnectionRequested += (socket) => { eventInvoked = true; mevent.Set(); }; WebSocketProtocol ipvClient = this.CreateWSClientProtocol(); var clientSocket = ipvClient.Connect(serverAddress, PORT); mevent.Wait(10000); Assert.IsTrue(eventInvoked); }