public void AsyncCallbackIPV4SendLargeBufferTest() { try { NetworkBuffer buffer = TestData.GetMidSizeBuffer(); byte[] sentData = null; int bytesSent = 0; ManualResetEventSlim mevent = new ManualResetEventSlim(false); while ((sentData = buffer.Read(WebSocketProtocol.BUFFER_SIZE)) != null) { mevent.Reset(); ipv4Client.SendAsync(sentData, (sent) => { bytesSent += sent; ipv4ServerClient.ReceiveAsync(); mevent.Set(); }); mevent.Wait(1000); } Assert.AreEqual(buffer.Size, bytesSent, "Not all bytes were sent"); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void SynchronousIPV4SendLargeBufferTest() { try { NetworkBuffer buffer = TestData.GetMidSizeBuffer(); int sent = 0; byte[] sentData = null; while (null != (sentData = buffer.Read(WebSocketProtocol.BUFFER_SIZE))) { sent += ipv4Client.Send(sentData); var task = ipv4ServerClient.ReceiveAsync(); } Assert.AreEqual(buffer.Size, sent, "Not all bytes were sent"); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }