|
1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System.IO;
- using System.Threading;
- using System.Threading.Tasks;
- using MQTTnet.Channel;
-
- namespace MQTTnet.Core.Internal
- {
- public class TestMqttChannel : IMqttChannel
- {
- private readonly MemoryStream _stream;
-
- public TestMqttChannel(MemoryStream stream)
- {
- _stream = stream;
- }
-
- public void Dispose()
- {
- }
-
- public Task ConnectAsync(CancellationToken cancellationToken)
- {
- return Task.FromResult(0);
- }
-
- public Task DisconnectAsync()
- {
- return Task.FromResult(0);
- }
-
- public Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
- {
- return _stream.ReadAsync(buffer, offset, count, cancellationToken);
- }
-
- public Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
- {
- return _stream.WriteAsync(buffer, offset, count, cancellationToken);
- }
- }
- }
|