You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "AR (JIRA)" <ji...@apache.org> on 2014/10/07 23:11:34 UTC
[jira] [Created] (AMQ-5385) Link Stealing fails when client
reconnects more than once
AR created AMQ-5385:
-----------------------
Summary: Link Stealing fails when client reconnects more than once
Key: AMQ-5385
URL: https://issues.apache.org/jira/browse/AMQ-5385
Project: ActiveMQ
Issue Type: Bug
Components: MQTT
Affects Versions: 5.11.0
Reporter: AR
Modified existing JUnit test case to connect with the same clientid more than once. Existing Test case tried once, which succeeded.
When client reconnects the second time (third connection attempt with the same clientid), link stealing does not happen.
Following is the modified test case.
{noformat}
@Test(timeout = 60 * 1000)
public void testDuplicateClientId() throws Exception {
// test link stealing enabled by default
final String clientId = "duplicateClient";
MQTT mqtt = createMQTTConnection(clientId, false);
mqtt.setKeepAlive((short) 2);
final BlockingConnection connection = mqtt.blockingConnection();
connection.connect();
final String TOPICA = "TopicA";
connection.publish(TOPICA, TOPICA.getBytes(), QoS.EXACTLY_ONCE, true);
MQTT mqtt1 = createMQTTConnection(clientId, false);
mqtt1.setKeepAlive((short) 2);
final BlockingConnection connection1 = mqtt1.blockingConnection();
connection1.connect();
assertTrue("Duplicate client disconnected", Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
return connection1.isConnected();
}
}));
assertTrue("Old client still connected", Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
return !connection.isConnected();
}
}));
MQTT mqtt2 = createMQTTConnection(clientId, false);
mqtt2.setKeepAlive((short) 2);
final BlockingConnection connection4 = mqtt2.blockingConnection();
connection4.connect();
assertTrue("Old client still connected", Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
return !connection1.isConnected();
}
}));
assertTrue("Duplicate client disconnected", Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
return connection4.isConnected();
}
}));
connection4.disconnect();
}
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)