Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowIOExceptionWhenNotEnoughDataReceivedBeforeClose() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldThrowIOExceptionWhenNotEnoughDataReceivedBeforeClose()
        {
            // Given
            WebSocketClient     client = mock(typeof(WebSocketClient));
            WebSocketConnection conn   = new WebSocketConnection(client);

            when(client.Stopped).thenReturn(true, true);

            sbyte[] data = new sbyte[] { 0, 1, 2, 3 };

            // When && Then
            conn.OnWebSocketBinary(data, 0, 4);

            ExpectedException.expect(typeof(IOException));
            ExpectedException.expectMessage("Connection closed while waiting for data from the server.");
            conn.Recv(10);
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotThrowAnyExceptionWhenDataReceivedBeforeClose() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotThrowAnyExceptionWhenDataReceivedBeforeClose()
        {
            // Given
            WebSocketClient     client = mock(typeof(WebSocketClient));
            WebSocketConnection conn   = new WebSocketConnection(client);

            when(client.Stopped).thenReturn(true);

            sbyte[] data = new sbyte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            // When
            conn.OnWebSocketBinary(data, 0, 10);
            conn.Recv(10);

            // Then
            // no exception
        }