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); } } } }
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); } } } }
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; } }
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)); } } } }
public void Init(ServerConnection serverConnection) { con = serverConnection; }
public void Init(ServerConnection serverConnection) { }
public ClientSubscription(Guid clientId, ServerConnection connection) { this.clientId = clientId; this.connection = connection; }
public ConnectionTests() { connection = new ServerConnection(8181, new PongServerIntegration()); }