Java Code Examples for io.netty.handler.codec.mqtt.MqttMessage#getClass()
The following examples show how to use
io.netty.handler.codec.mqtt.MqttMessage#getClass() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MQTTRejectingInterceptorTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Test(timeout = 60000) public void testRejectedMQTTMessage() throws Exception { final String addressQueue = name.getMethodName(); final String msgText = "Test rejected message"; final MQTTClientProvider subscribeProvider = getMQTTClientProvider(); initializeConnection(subscribeProvider); subscribeProvider.subscribe(addressQueue, AT_MOST_ONCE); MQTTInterceptor incomingInterceptor = new MQTTInterceptor() { @Override public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException { if (packet.getClass() == MqttPublishMessage.class) { return false; } else { return true; } } }; server.getRemotingService().addIncomingInterceptor(incomingInterceptor); final MQTTClientProvider publishProvider = getMQTTClientProvider(); initializeConnection(publishProvider); publishProvider.publish(addressQueue, msgText.getBytes(), AT_MOST_ONCE, false); assertNull(subscribeProvider.receive(3000)); subscribeProvider.disconnect(); publishProvider.disconnect(); }
Example 2
Source File: MQTTTestSupport.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException { if (packet.getClass() == MqttPublishMessage.class) { messageCount++; } return true; }
Example 3
Source File: MQTTTestSupport.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException { if (packet.getClass() == MqttPublishMessage.class) { messageCount++; } return true; }