mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-16 17:23:04 +08:00
44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
using System.IO;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using MQTTnet.Channel;
|
|
|
|
namespace MQTTnet.Internal
|
|
{
|
|
public class TestMqttChannel : IMqttChannel
|
|
{
|
|
private readonly MemoryStream _stream;
|
|
|
|
public TestMqttChannel(MemoryStream stream)
|
|
{
|
|
_stream = stream;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
}
|
|
|
|
public string Endpoint { get; }
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|