public void TestSetup()
        {
            SocketServer = new ServerInstance(11000, 1);
            var protocol = new Battlefield3Protocol() {Bf3Server = {Password = "******"}};
            SocketServer.SetProtocol(protocol);

            Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            ServerInstance = protocol.Bf3Server;
            Session = Connect();
            Session.StartReceiving();
        }
Exemplo n.º 2
0
 public void TestSetup()
 {
     serverInstance = new ServerInstance(DEFAULT_PORT, 2);
     socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     serverInstance.ClientConnected += (sender, args) => session = (Session) args.Session;
     serverInstance.Start();
     socket.Connect(DEFAULT_HOST, DEFAULT_PORT);
     while (session == null)
     {
         Thread.Sleep(10);
     }
     Assert.IsNotNull(session);
 }
 public void TestCleanUp()
 {
     if (Socket != null)
     {
         Socket.Close();
         Socket = null;
     }
     if (Session != null)
     {
         Session = null;
     }
     if (ServerInstance != null)
     {
         SocketServer.Stop();
         SocketServer = null;
     }
 }
        public RConDevServerApplication()
        {
            // create the server instance
            var serverInstance = new ServerInstance(Settings.Default.ListenOnPort, Settings.Default.MaxSessions);
            var viewModel = new ServerFormViewModel(serverInstance);

            var connectionString = ConfigurationManager.ConnectionStrings["Default"];
            var connection = new SQLiteConnection(connectionString.ConnectionString);

            var kernel = new StandardKernel();
            IServiceLocator serviceLocator = new NinjectServiceLocator(kernel);
            serviceLocator.RegisterService(typeof(IDbConnection), connection);

            // read all available protocols
            IList<IRconProtocol> protocols = new ProtocolLoader().LoadProtocols("protocols", serviceLocator.Clone() as IServiceLocator);
            viewModel.AvailableProtocols = protocols;

            var serverForm = new ServerForm
                {
                    DataContext = viewModel
                };
            this.MainForm = serverForm;
        }
Exemplo n.º 5
0
 public void TestSetup()
 {
     serverInstance = new ServerInstance(DEFAULT_PORT, 2);
     socket = new TcpClient(AddressFamily.InterNetwork);
 }