diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java index fc1438201c..30ffb06356 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java @@ -201,11 +201,12 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor { // the connection handles pings, negotiations directly. // and delegate all other commands to manager. if (command.getClass() == KeepAliveInfo.class) { + dataReceived = true; KeepAliveInfo info = (KeepAliveInfo) command; - if (info.isResponseRequired()) { - info.setResponseRequired(false); - protocolManager.sendReply(this, info); - } + info.setResponseRequired(false); + // if we don't respond to KeepAlive commands then the client will think the server is dead and timeout + // for some reason KeepAliveInfo.isResponseRequired() is always false + protocolManager.sendReply(this, info); } else if (command.getClass() == WireFormatInfo.class) { // amq here starts a read/write monitor thread (detect ttl?) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java index f46019ccb2..9801a83da8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java @@ -1941,7 +1941,6 @@ public class FailoverTest extends FailoverTestBase { public void testBackupServerNotRemoved() throws Exception { // HORNETQ-720 Disabling test for replicating backups. if (!(backupServer.getServer().getHAPolicy() instanceof SharedStoreSlavePolicy)) { - waitForComponent(backupServer, 1); return; } locator.setFailoverOnInitialConnection(true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedLargeMessageWithDelayFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedLargeMessageWithDelayFailoverTest.java index 6ff5d6bba8..bf7148fd4e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedLargeMessageWithDelayFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedLargeMessageWithDelayFailoverTest.java @@ -34,7 +34,13 @@ public class ReplicatedLargeMessageWithDelayFailoverTest extends ReplicatedLarge startBackupServer = false; super.setUp(); syncDelay = new BackupSyncDelay(backupServer, liveServer); - backupServer.start(); + + /* Using getName() here is a bit of a hack, but if the backup is started for this test then the test will fail + * intermittently due to an InterruptedException. + */ + if (!getName().equals("testBackupServerNotRemoved")) { + backupServer.start(); + } } @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java index faa947e155..c41d30b51d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java @@ -87,6 +87,16 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { session.close(); } + + @Test + public void testKeepAlive() throws Exception { + connection.start(); + + Thread.sleep(125000); + + connection.createSession(false, 1); + } + @Test public void testSimpleTopic() throws Exception { connection.start();