Exemplo n.º 1
0
 public void Will_not_crash_if_client_connect_and_immediately_disconnects()
 {
     using (var server = new ServerConnection(8181, new FakeServerIntegration()))
     {
         server.Start();
         for (int i = 0; i < 5; i++)
         {
             using (var tcp = new TcpClient())
             {
                 tcp.Connect("localhost", 8181);
             }
         }
     }
 }
Exemplo n.º 2
0
        public void Can_handle_client_connecting_and_just_hanging_on()
        {
            using (var server = new ServerConnection(8181, new FakeServerIntegration()))
            {
                server.Start();
                using (var tcp = new TcpClient())
                {
                    tcp.Connect("localhost", 8181);

                    using (var tcp2 = new TcpClient())
                    {
                        tcp2.Connect("localhost", 8181);
                    }
                }
            }
        }
Exemplo n.º 3
0
        public RavenMqServer(InMemoryRavenConfiguration settings)
        {
            settings.LoadLoggingSettings();
            queues = new Queues(settings);

            try
            {
                server = new QueuesHttpServer(settings, queues);
                server.Start();

                serverConnection = new ServerConnection(settings.SubscriptionPort,new QueuesSubscriptionIntegration(queues));
                serverConnection.Start();
            }
            catch (Exception)
            {
                queues.Dispose();
                queues = null;

                throw;
            }
        }
Exemplo n.º 4
0
 public void Will_not_crash_if_client_connect_and_send_garbage_data()
 {
     using (var server = new ServerConnection(8181, new FakeServerIntegration()))
     {
         server.Start();
         for (var i = 0; i < 5; i++)
         {
             using (var tcp = new TcpClient())
             {
                 tcp.Connect("localhost", 8181);
                 var networkStream = tcp.GetStream();
                 var buffer = new byte[16];
                 new Random(8383).NextBytes(buffer);
                 Array.Copy(BitConverter.GetBytes(12), 0, buffer, 0, 4);
                 networkStream.Write(buffer, 0, buffer.Length);
                 networkStream.Flush();
                 networkStream.Read(buffer, 0, 4);
                 var jObject = networkStream.ToJObject();
                 Assert.Equal("{\"Type\":\"Error\",\"Error\":\"Invalid server signature\"}", jObject.ToString(Formatting.None));
             }
         }
     }
 }
Exemplo n.º 5
0
 public void Init(ServerConnection serverConnection)
 {
     con = serverConnection;
 }
Exemplo n.º 6
0
 public void Init(ServerConnection serverConnection)
 {
 }
Exemplo n.º 7
0
 public ClientSubscription(Guid clientId, ServerConnection connection)
 {
     this.clientId = clientId;
     this.connection = connection;
 }
Exemplo n.º 8
0
 public ConnectionTests()
 {
     connection = new ServerConnection(8181, new PongServerIntegration());
 }