public void BasicSerialization() { MqttPingRequestMessage pingReqMsg = new MqttPingRequestMessage(); byte[] bytes = MessageSerializationHelper.GetMessageBytes(pingReqMsg); Assert.Equal<byte>(192, bytes[0]); }
/// <summary> /// Pings the message broker if there has been no activity for the specified amount of idle time. /// </summary> /// <param name="state"></param> private void PingRequired(object state) { // if we can't get the montor then the connection has been / is currently being disposed, so // we don't want to do a ping (the connection handler might no longer be valid) if (Monitor.TryEnter(shutdownPadlock)) { try { var pingMsg = new MqttPingRequestMessage(); connectionHandler.SendMessage(pingMsg); } finally { Monitor.Exit(shutdownPadlock); } } }