use of org.apache.activemq.artemis.tests.integration.mqtt.imported.FuseMQTTClientProvider in project activemq-artemis by apache.
the class StompTest method sendMQTTReceiveSTOMP.
@Test
public void sendMQTTReceiveSTOMP() throws Exception {
String payload = "This is a test message";
// Set up STOMP subscription
conn.connect(defUser, defPass);
subscribe(conn, null, Stomp.Headers.Subscribe.AckModeValues.AUTO);
// Send MQTT Message
MQTTClientProvider clientProvider = new FuseMQTTClientProvider();
clientProvider.connect("tcp://" + hostname + ":" + port);
clientProvider.publish(getQueuePrefix() + getQueueName(), payload.getBytes(), 0);
clientProvider.disconnect();
// Receive STOMP Message
ClientStompFrame frame = conn.receiveFrame();
assertTrue(frame.getBody().contains(payload));
}
use of org.apache.activemq.artemis.tests.integration.mqtt.imported.FuseMQTTClientProvider in project activemq-artemis by apache.
the class StompTest method sendSTOMPReceiveMQTT.
@Test
public void sendSTOMPReceiveMQTT() throws Exception {
// Set up MQTT Subscription
MQTTClientProvider clientProvider = new FuseMQTTClientProvider();
clientProvider.connect("tcp://" + hostname + ":" + port);
clientProvider.subscribe(getTopicPrefix() + getTopicName(), 0);
String stompPayload = "This is a test message";
// Set up STOMP connection and send STOMP Message
conn.connect(defUser, defPass);
send(conn, getTopicPrefix() + getTopicName(), null, stompPayload);
// Receive MQTT Message
byte[] mqttPayload = clientProvider.receive(10000);
clientProvider.disconnect();
assertEquals(stompPayload, new String(mqttPayload, "UTF-8"));
clientProvider.disconnect();
}
Aggregations