}); endpoint.accept(false); });
endpoint.accept(false);
endpoint.accept(false);
/** * Like {@link io.vertx.rxjava.mqtt.MqttEndpoint#accept} with no session is present. * @return */ public io.vertx.rxjava.mqtt.MqttEndpoint accept() { delegate.accept(); return this; }
/** * Sends the CONNACK message to the remote MQTT client with "connection accepted" * return code. See {@link io.vertx.rxjava.mqtt.MqttEndpoint#reject} for refusing connection * @param sessionPresent if a previous session is present * @return a reference to this, so the API can be used fluently */ public MqttEndpoint accept(boolean sessionPresent) { delegate.accept(sessionPresent); return this; }
/** * Sends the CONNACK message to the remote MQTT client with "connection accepted" * return code. See {@link io.vertx.rxjava.mqtt.MqttEndpoint#reject} for refusing connection * @param sessionPresent if a previous session is present * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.mqtt.MqttEndpoint accept(boolean sessionPresent) { delegate.accept(sessionPresent); return this; }
/** * Like {@link io.vertx.rxjava.mqtt.MqttEndpoint#accept} with no session is present. * @return */ public io.vertx.rxjava.mqtt.MqttEndpoint accept() { delegate.accept(); return this; }
/** * Sends the CONNACK message to the remote MQTT client with "connection accepted" * return code. See {@link io.vertx.rxjava.mqtt.MqttEndpoint#reject} for refusing connection * @param sessionPresent if a previous session is present * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.mqtt.MqttEndpoint accept(boolean sessionPresent) { delegate.accept(sessionPresent); return this; }
@Override protected void endpointHandler(MqttEndpoint endpoint, TestContext context) { endpoint.accept(false); } }
@Override protected void endpointHandler(MqttEndpoint endpoint, TestContext context) { endpoint.accept(false); } }
@Override protected void endpointHandler(MqttEndpoint endpoint, TestContext context) { this.endpoint = endpoint; endpoint.disconnectHandler(v -> { log.info("MQTT remote client disconnected"); }); endpoint.accept(false); } }
@Override protected void endpointHandler(MqttEndpoint endpoint, TestContext context) { this.endpoint = endpoint; endpoint.disconnectHandler(v -> { log.info("MQTT remote client disconnected"); }); endpoint.accept(false); } }
@Override protected void endpointHandler(MqttEndpoint endpoint, TestContext context) { endpoint.closeHandler(v -> { log.info("MQTT remote client connection closed"); }); endpoint.accept(false); } }
@Override protected void endpointHandler(MqttEndpoint endpoint, TestContext context) { endpoint.closeHandler(v -> { log.info("MQTT remote client connection closed"); }); endpoint.accept(false); } }
@Override protected void endpointHandler(MqttEndpoint endpoint, TestContext context) { endpoint.exceptionHandler(t -> { log.error("Exception raised", t); if (t instanceof DecoderException) { this.async.complete(); } }); endpoint.accept(false); } }
@Override protected void endpointHandler(MqttEndpoint endpoint, TestContext context) { endpoint.exceptionHandler(t -> { log.error("Exception raised", t); if (t instanceof DecoderException) { this.async.complete(); } }); endpoint.accept(false); } }
@Test public void connectionAlreadyAccepted(TestContext context) throws Exception { this.expectedReturnCode = MqttConnectReturnCode.CONNECTION_ACCEPTED; MemoryPersistence persistence = new MemoryPersistence(); MqttClient client = new MqttClient(String.format("tcp://%s:%d", MQTT_SERVER_HOST, MQTT_SERVER_PORT), "12345", persistence); client.connect(); try { // try to accept a connection already accepted this.endpoint.accept(false); context.fail(); } catch (IllegalStateException e) { // Ok } }
@Override protected void endpointHandler(MqttEndpoint endpoint, TestContext context) { endpoint.disconnectHandler(v -> { log.info("MQTT remote client disconnected"); }); endpoint.closeHandler(v -> { log.info("MQTT remote client connection closed"); }); endpoint.accept(false); } }
@Override protected void endpointHandler(MqttEndpoint endpoint, TestContext context) { endpoint.disconnectHandler(v -> { log.info("MQTT remote client disconnected"); }); endpoint.closeHandler(v -> { log.info("MQTT remote client connection closed"); }); endpoint.accept(false); } }
@Override protected void endpointHandler(MqttEndpoint endpoint, TestContext context) { endpoint.subscribeHandler(subscribe -> { List<MqttQoS> qos = new ArrayList<>(); qos.add(subscribe.topicSubscriptions().get(0).qualityOfService()); endpoint.subscribeAcknowledge(subscribe.messageId(), qos); this.subscribeAsync.complete(); }).unsubscribeHandler(unsubscribe -> { endpoint.unsubscribeAcknowledge(unsubscribe.messageId()); this.unsubscribeAsync.complete(); }); endpoint.accept(false); } }