Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

44 righe
1.1 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 string Endpoint { get; }
  18. public Task ConnectAsync(CancellationToken cancellationToken)
  19. {
  20. return Task.FromResult(0);
  21. }
  22. public Task DisconnectAsync()
  23. {
  24. return Task.FromResult(0);
  25. }
  26. public Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
  27. {
  28. return _stream.ReadAsync(buffer, offset, count, cancellationToken);
  29. }
  30. public Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
  31. {
  32. return _stream.WriteAsync(buffer, offset, count, cancellationToken);
  33. }
  34. }
  35. }