public void RunBeforeEveryTest() { _utility = new NetworkUtilities(); _testConnectionServer = new TcpConnectionServer(_utility.GetLocalIPAddress(), 8080); _testScheduler = new CommandScheduler(); _testServer = new EditorConnectionServer(_testConnectionServer, _testScheduler, 15000); }
public void RunBeforeEveryTest() { var networkUtilities = new NetworkUtilities(); _localIpAddress = networkUtilities.GetLocalIPAddress(); _server = new TcpConnectionServer(_localIpAddress, 15845); }
public void ConnectHost(string username, JeffistanceMessageProcessor messageProcessor) { username = string.IsNullOrWhiteSpace(username) ? DEFAULT_HOST_NAME : username; Host.Name = username; Host.Connect(NetworkUtilities.GetLocalIPAddress(), Connection.PORT_NO); Host.AttachMessageHandler(new MessageHandler(messageProcessor, Host.Connection)); Host.GreetServer(); }
public void RunBeforeEveryTest() { var networkUtilities = new NetworkUtilities(); _localIpAddress = networkUtilities.GetLocalIPAddress(); _server = new TcpConnectionServer(_localIpAddress, 15845); _testClient = Substitute.For <IConnectionClient>(); }
public void RunBeforeEveryTest() { var networkUtilities = new NetworkUtilities(); _localIpAddress = networkUtilities.GetLocalIPAddress(); _testPort = 15987; _testListener = new TcpConnectionServer(_localIpAddress, _testPort); _testListener.StartServer(); }
private void Install() { var service = new NetworkUtilities(); var scheduler = new CommandScheduler(); var serverConnection = new TcpConnectionServer(service.GetLocalIPAddress(), ServerPort); _server = new EditorConnectionServer(serverConnection, scheduler, BroadcastPort); ServerText.text = string.Format("Server running on {0}", serverConnection.Adress + ":" + serverConnection.Port.ToString()); }
public void Run(int port) { Connection = new ServerConnection(port); MessageHandler = new MessageHandler(new ServerMessageProcessor(this), Connection); ObservableUserList.CollectionChanged += OnUserListChanged; Connection.OnDisconnection += OnUserDisconnect; Connection.OnMessageReceived += MessageHandler.OnMessageReceived; Connection.Run(); var ip = NetworkUtilities.GetLocalIPAddress(); _logger.LogInformation($"Started server on {ip}:{port}"); }
public void TestConnection() { server.Run(); var client = new ClientConnection(NetworkUtilities.GetLocalIPAddress(), DEFAULT_PORT); while (true) { if (server.Clients.Count > 0) { break; } } Assert.IsTrue(server.Clients.Count > 0); // FIXME vvvvv THIS SHOULD WORK ^^^^^^^ THIS SHOULDN'T // Assert.That(server.Clients.Count, Is.GreaterThan(0).After(5).Seconds.PollEvery(500).MilliSeconds); }
public Host(int port = DEFAULT_PORT, string username = "******", bool dedicated = false) : base(username) { IsHost = true; Server = new ServerConnection(port); Perms = new Permissions { CanKick = true }; Server.OnMessageReceived += OnMessageReceived; Server.OnConnection += OnConnection; Server.Run(); if (!dedicated) { Connect(NetworkUtilities.GetLocalIPAddress(), port); } }
public IEnumerator ServerShouldBroadcastIpAndPortAfterStart() { var testReceiver = new UdpBroadcastReceiver(15000); testReceiver.StartReceiveBroadcast(); _testServer.StartServer(); var called = false; testReceiver.BroadcastDataReceived += data => { called = true; Assert.AreEqual(_utility.GetLocalIPAddress() + ":8080", data); }; _testScheduler.Tick(); yield return(new WaitForSeconds(0.5f)); Assert.IsTrue(called); testReceiver.StopReceiveBroadcast(); }
public void TestDisconnectClient() { server.Run(); var client = new ClientConnection(NetworkUtilities.GetLocalIPAddress(), DEFAULT_PORT); while (true) { if (server.Clients.Count > 0) { break; } } foreach (ClientConnection c in server.Clients.ToArray()) { server.Kick(c); } Assert.IsTrue(server.Clients.Count == 0); }
public TcpInboundServerConfiguration() { IPAddress = NetworkUtilities.GetLocalIPAddress(); Port = 8801; }
public TcpOutboundClientConfiguration() { IPAddress = NetworkUtilities.GetLocalIPAddress(); Port = 9901; }