public void RejectConnectionIfListenerDoesntExists() { var clientSocket = IntradomainSocket.ClientSocket("1"); var connected = IntradomainConnectionManager.Instance.Connect(clientSocket); Assert.IsFalse(connected); Assert.IsFalse(IntradomainConnectionManager.Instance.Connected(clientSocket)); }
public void ShowEstablishedConnection() { var clientSocket = IntradomainSocket.ClientSocket("1"); IntradomainConnectionManager.Instance.Listen("1", endpoint => IntradomainSocket.ServerSocket("1", clientSocket.ConnectionId)); clientSocket.ConnectionId = "1"; var connected = IntradomainConnectionManager.Instance.Connect(clientSocket); Assert.That(connected); Assert.That(IntradomainConnectionManager.Instance.Connected(clientSocket)); }
public void NotShowClosedConnection() { var clientSocket = IntradomainSocket.ClientSocket("1"); IntradomainConnectionManager.Instance.Listen("1", endpoint => IntradomainSocket.ServerSocket("1", clientSocket.ConnectionId)); clientSocket.ConnectionId = "1"; IntradomainConnectionManager.Instance.Connect(clientSocket); IntradomainConnectionManager.Instance.Disconnect(clientSocket); Assert.IsFalse(IntradomainConnectionManager.Instance.Connected(clientSocket)); }
public void CallProvidedMethodOnNewClientConnection() { bool wasCalled = false; IntradomainConnectionManager.Instance.Listen("1", endpoint => { wasCalled = true; return(null); }); IntradomainConnectionManager.Instance.Connect(IntradomainSocket.ClientSocket("1")); Assert.That(wasCalled); }