You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

42 lines
1.0 KiB

  1. using System.IO;
  2. using System.Threading;
  3. using System.Threading.Tasks;
  4. using MQTTnet.Channel;
  5. namespace MQTTnet.Core.Internal
  6. {
  7. public class TestMqttChannel : IMqttChannel
  8. {
  9. private readonly MemoryStream _stream;
  10. public TestMqttChannel(MemoryStream stream)
  11. {
  12. _stream = stream;
  13. }
  14. public void Dispose()
  15. {
  16. }
  17. public Task ConnectAsync(CancellationToken cancellationToken)
  18. {
  19. return Task.FromResult(0);
  20. }
  21. public Task DisconnectAsync()
  22. {
  23. return Task.FromResult(0);
  24. }
  25. public Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
  26. {
  27. return _stream.ReadAsync(buffer, offset, count, cancellationToken);
  28. }
  29. public Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
  30. {
  31. return _stream.WriteAsync(buffer, offset, count, cancellationToken);
  32. }
  33. }
  34. }