async Task <MqttConnAckPacket> Authenticate(ILowLevelMqttClient client) { await client.SendAsync(new MqttConnectPacket { CleanSession = true, ClientId = TestContext.TestName, Username = "******", Password = Encoding.UTF8.GetBytes("pass") }, CancellationToken.None).ConfigureAwait(false); return(await client.ReceiveAsync(CancellationToken.None).ConfigureAwait(false) as MqttConnAckPacket); }
async Task <MqttSubAckPacket> Subscribe(ILowLevelMqttClient client, string topic) { await client.SendAsync(new MqttSubscribePacket { PacketIdentifier = 1, TopicFilters = new List <MqttTopicFilter> { new MqttTopicFilter { Topic = topic } } }, CancellationToken.None).ConfigureAwait(false); return(await client.ReceiveAsync(CancellationToken.None).ConfigureAwait(false) as MqttSubAckPacket); }