async Task HandleConnectionExceptionAsync(Exception exception) { if (exception is TimeoutException) { await NotifyErrorAsync(ServerProperties.ServerPacketListener_NoConnectReceived, exception); } else if (exception is MqttConnectionException) { _tracer.Error(exception, ServerProperties.ServerPacketListener_ConnectionError(_clientId ?? "N/A")); MqttConnectionException connectEx = exception as MqttConnectionException; ConnectAck errorAck = new ConnectAck(connectEx.ReturnCode, existingSession: false); try { await _channel.SendAsync(errorAck); } catch (Exception ex) { await NotifyErrorAsync(ex); } } else { await NotifyErrorAsync(exception); } }