NO-JIRA MQTT interceptor example checkstyle
This commit is contained in:
parent
8d3f484387
commit
3d89a5eb21
|
@ -54,7 +54,7 @@ public class InterceptorExample {
|
||||||
|
|
||||||
// Receive the sent message
|
// Receive the sent message
|
||||||
Message message1 = connection.receive(5, TimeUnit.SECONDS);
|
Message message1 = connection.receive(5, TimeUnit.SECONDS);
|
||||||
|
|
||||||
String messagePayload = new String(message1.getPayload(), StandardCharsets.UTF_8);
|
String messagePayload = new String(message1.getPayload(), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
System.out.println("Received message: " + messagePayload);
|
System.out.println("Received message: " + messagePayload);
|
||||||
|
|
|
@ -51,8 +51,7 @@ public class SimpleMQTTInterceptor implements MQTTInterceptor {
|
||||||
String modifiedMessage = "Modified message ";
|
String modifiedMessage = "Modified message ";
|
||||||
|
|
||||||
message.payload().setBytes(0, modifiedMessage.getBytes());
|
message.payload().setBytes(0, modifiedMessage.getBytes());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (mqttMessage instanceof MqttConnectMessage) {
|
if (mqttMessage instanceof MqttConnectMessage) {
|
||||||
MqttConnectMessage connectMessage = (MqttConnectMessage) mqttMessage;
|
MqttConnectMessage connectMessage = (MqttConnectMessage) mqttMessage;
|
||||||
System.out.println("A MQTT CONNECT control packet was intercepted " + connectMessage);
|
System.out.println("A MQTT CONNECT control packet was intercepted " + connectMessage);
|
||||||
|
|
Loading…
Reference in New Issue