/** * @return return code from the connection request */ public MqttConnectReturnCode code() { if (cached_0 != null) { return cached_0; } MqttConnectReturnCode ret = delegate.code(); cached_0 = ret; return ret; }
/** * @return return code from the connection request */ public MqttConnectReturnCode code() { if (cached_0 != null) { return cached_0; } MqttConnectReturnCode ret = delegate.code(); cached_0 = ret; return ret; }
/** * Used for calling the connect handler when the server replies to the request * * @param msg connection response message */ private void handleConnack(MqttConnAckMessage msg) { synchronized (this) { this.isConnected = msg.code() == MqttConnectReturnCode.CONNECTION_ACCEPTED; } Handler<AsyncResult<MqttConnAckMessage>> handler = connectHandler(); if (handler != null) { if (msg.code() == MqttConnectReturnCode.CONNECTION_ACCEPTED) { handler.handle(Future.succeededFuture(msg)); } else { MqttConnectionException exception = new MqttConnectionException(msg.code()); log.error(String.format("Connection refused by the server - code: %s", msg.code())); handler.handle(Future.failedFuture(exception)); } } }
/** * Used for calling the connect handler when the server replies to the request * * @param msg connection response message */ private void handleConnack(MqttConnAckMessage msg) { synchronized (this) { this.isConnected = msg.code() == MqttConnectReturnCode.CONNECTION_ACCEPTED; } Handler<AsyncResult<MqttConnAckMessage>> handler = connectHandler(); if (handler != null) { if (msg.code() == MqttConnectReturnCode.CONNECTION_ACCEPTED) { handler.handle(Future.succeededFuture(msg)); } else { MqttConnectionException exception = new MqttConnectionException(msg.code()); log.error(String.format("Connection refused by the server - code: %s", msg.code())); handler.handle(Future.failedFuture(exception)); } } }