public static BufferOffsetSize GetTextBuffer(HandshakeInstrumentType type) { var text = string.Format("@{0}:{1}", type, TheQuickBrownFox); var buffer = Encoding.UTF8.GetBytes(text); return(new BufferOffsetSize(buffer)); }
internal bool HasInstrument (HandshakeInstrumentType type) { return handshakeInstruments != null ? handshakeInstruments.Contains (type) : false; }
public static BufferOffsetSize GetTextBuffer (HandshakeInstrumentType type) { var text = string.Format ("@{0}:{1}", type, TheQuickBrownFox); var buffer = Encoding.UTF8.GetBytes (text); return new BufferOffsetSize (buffer); }
async Task RunMainLoopBlob (TestContext ctx, HandshakeInstrumentType type, CancellationToken cancellationToken) { var expected = Instrumentation.GetTextBuffer (type).GetBuffer (); var buffer = new byte [4096]; int ret = await Server.Stream.ReadAsync (buffer, 0, buffer.Length); ctx.Assert (ret, Is.EqualTo (expected.Length)); buffer = new BufferOffsetSize (buffer, 0, ret).GetBuffer (); ctx.Assert (buffer, Is.EqualTo (expected), "blob"); await Shutdown (ctx, SupportsCleanShutdown, true, cancellationToken); }
public bool HasInstrument (HandshakeInstrumentType type) { return Parameters.HandshakeInstruments != null && Parameters.HandshakeInstruments.Contains (type); }
public bool HasInstrument(HandshakeInstrumentType type) { return(Parameters.HandshakeInstruments != null && Parameters.HandshakeInstruments.Contains(type)); }
protected async Task WriteBlob(TestContext ctx, ICommonConnection connection, HandshakeInstrumentType type, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); LogDebug(ctx, 2, "WriteBlob", connection, type); var blob = Instrumentation.GetTextBuffer(type); await connection.Stream.WriteAsync(blob.Buffer, blob.Offset, blob.Size, cancellationToken); LogDebug(ctx, 2, "WriteBlob done", connection, type); }
protected async Task ExpectBlob(TestContext ctx, ICommonConnection connection, HandshakeInstrumentType type, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); LogDebug(ctx, 2, "ExpectBlob", connection, type); var buffer = new byte [4096]; var blob = Instrumentation.GetTextBuffer(type); var ret = await connection.Stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken); LogDebug(ctx, 2, "ExpectBlob #1", connection, type, ret); if (ctx.Expect(ret, Is.GreaterThan(0), "read success")) { var result = new BufferOffsetSize(buffer, 0, ret); ctx.Expect(result, new IsEqualBlob(blob), "blob"); } LogDebug(ctx, 2, "ExpectBlob done", connection, type); }
internal bool HasInstrument(HandshakeInstrumentType type) { return(handshakeInstruments != null?handshakeInstruments.Contains(type) : false); }
protected Task WriteBlob(TestContext ctx, ICommonConnection connection, HandshakeInstrumentType type, CancellationToken cancellationToken) { return(WriteBlob(ctx, connection, type.ToString(), Instrumentation.GetTextBuffer(type), cancellationToken)); }
protected async Task WriteBlob (TestContext ctx, ICommonConnection connection, HandshakeInstrumentType type, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested (); LogDebug (ctx, 2, "WriteBlob", connection, type); var blob = Instrumentation.GetTextBuffer (type); await connection.Stream.WriteAsync (blob.Buffer, blob.Offset, blob.Size, cancellationToken); LogDebug (ctx, 2, "WriteBlob done", connection, type); }
protected async Task ExpectBlob (TestContext ctx, ICommonConnection connection, HandshakeInstrumentType type, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested (); LogDebug (ctx, 2, "ExpectBlob", connection, type); var buffer = new byte [4096]; var blob = Instrumentation.GetTextBuffer (type); var ret = await connection.Stream.ReadAsync (buffer, 0, buffer.Length, cancellationToken); LogDebug (ctx, 2, "ExpectBlob #1", connection, type, ret); if (ctx.Expect (ret, Is.GreaterThan (0), "read success")) { var result = new BufferOffsetSize (buffer, 0, ret); ctx.Expect (result, new IsEqualBlob (blob), "blob"); } LogDebug (ctx, 2, "ExpectBlob done", connection, type); }
public static byte[] GetTextBuffer(HandshakeInstrumentType type) { var text = string.Format("@{0}:{1}", type, TheQuickBrownFox); return(Encoding.UTF8.GetBytes(text)); }