Skip to content

Commit 01d9e34

Browse files
committed
Undoing keepalive change from yesterday, adding disable proxy to v5 offline buffering tests
Signed-off-by: James Sutton <james.sutton@uk.ibm.com>
1 parent a083bd5 commit 01d9e34

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

  • org.eclipse.paho.client.mqttv3.test/src/test/java/org/eclipse/paho/client/mqttv3/test/connectionLoss
  • org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal
  • org.eclipse.paho.mqttv5.client/src/test/java/org/eclipse/paho/mqttv5/client/test/automaticReconnect

org.eclipse.paho.client.mqttv3.test/src/test/java/org/eclipse/paho/client/mqttv3/test/connectionLoss/ConnectionLossTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.eclipse.paho.client.mqttv3.test.properties.TestProperties;
3434
import org.eclipse.paho.client.mqttv3.test.utilities.ConnectionManipulationProxyServer;
3535
import org.eclipse.paho.client.mqttv3.test.utilities.Utility;
36+
import org.junit.After;
3637
import org.junit.AfterClass;
3738
import org.junit.Assert;
3839
import org.junit.BeforeClass;
@@ -90,8 +91,14 @@ public static void setUpBeforeClass() throws Exception{
9091
public static void tearDownAfterClass() throws Exception {
9192
log.info("Tests finished, stopping proxy");
9293
proxy.stopProxy();
93-
9494
}
95+
96+
@After
97+
public void afterTest() {
98+
log.info("Disabling Proxy");
99+
proxy.disableProxy();
100+
}
101+
95102
/**
96103
* Tests whether paho can detect a connection loss with the server even if it has outbound activity by publishing messages with QoS 0.
97104
* @throws Exception

org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal/ClientState.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,15 +774,15 @@ public MqttToken checkForActivity(IMqttActionListener pingCallback) throws MqttE
774774
tokenStore.saveToken(token, pingCommand);
775775
pendingFlows.insertElementAt(pingCommand, 0);
776776

777-
nextPingTime = this.keepAlive;
777+
nextPingTime = getKeepAlive();
778778

779779
//Wake sender thread since it may be in wait state (in ClientState.get())
780780
notifyQueueLock();
781781
}
782782
else {
783783
//@TRACE 634=ping not needed yet. Schedule next ping.
784784
log.fine(CLASS_NAME, methodName, "634", null);
785-
nextPingTime = Math.max(1, this.keepAlive - (time - lastOutboundActivity));
785+
nextPingTime = Math.max(1, getKeepAlive() - (time - lastOutboundActivity));
786786
}
787787
}
788788
//@TRACE 624=Schedule next ping at {0}

org.eclipse.paho.mqttv5.client/src/test/java/org/eclipse/paho/mqttv5/client/test/automaticReconnect/OfflineBufferingTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.eclipse.paho.mqttv5.common.MqttMessage;
2525
import org.eclipse.paho.mqttv5.common.packet.MqttProperties;
2626
import org.eclipse.paho.mqttv5.common.packet.MqttPublish;
27+
import org.junit.After;
2728
import org.junit.Assert;
2829
import org.junit.BeforeClass;
2930
import org.junit.Test;
@@ -63,6 +64,12 @@ public static void setUpBeforeClass() throws Exception {
6364
}
6465

6566
}
67+
68+
@After
69+
public void clearUpAfterTest() {
70+
proxy.disableProxy();
71+
}
72+
6673

6774
/**
6875
* Tests that A message can be buffered whilst the client is in a

0 commit comments

Comments
 (0)