Ejemplo n.º 1
0
 public void RunBeforeEveryTest()
 {
     _utility = new NetworkUtilities();
     _testConnectionServer = new TcpConnectionServer(_utility.GetLocalIPAddress(), 8080);
     _testScheduler        = new CommandScheduler();
     _testServer           = new EditorConnectionServer(_testConnectionServer, _testScheduler, 15000);
 }
Ejemplo n.º 2
0
        public void RunBeforeEveryTest()
        {
            var networkUtilities = new NetworkUtilities();

            _localIpAddress = networkUtilities.GetLocalIPAddress();
            _server         = new TcpConnectionServer(_localIpAddress, 15845);
        }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
        public void RunBeforeEveryTest()
        {
            var networkUtilities = new NetworkUtilities();

            _localIpAddress = networkUtilities.GetLocalIPAddress();
            _server         = new TcpConnectionServer(_localIpAddress, 15845);
            _testClient     = Substitute.For <IConnectionClient>();
        }
Ejemplo n.º 5
0
        public void RunBeforeEveryTest()
        {
            var networkUtilities = new NetworkUtilities();

            _localIpAddress = networkUtilities.GetLocalIPAddress();
            _testPort       = 15987;
            _testListener   = new TcpConnectionServer(_localIpAddress, _testPort);
            _testListener.StartServer();
        }
Ejemplo n.º 6
0
    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());
    }
Ejemplo n.º 7
0
        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}");
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
 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);
     }
 }
Ejemplo n.º 10
0
        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();
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
 public TcpInboundServerConfiguration()
 {
     IPAddress = NetworkUtilities.GetLocalIPAddress();
     Port      = 8801;
 }
 public TcpOutboundClientConfiguration()
 {
     IPAddress = NetworkUtilities.GetLocalIPAddress();
     Port      = 9901;
 }