public void ping() { try { if (disconnectCalled == false) { if (mqttConnection != null) { mqttConnection.ping(new PingCB(this)); } else { connect(); } } } catch (Exception) { //connect(); } }