Skip to content

Commit 801e850

Browse files
committed
test heartbeat logic
1 parent 2d80614 commit 801e850

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

test/src/com/rabbitmq/client/test/functional/FunctionalTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
public class FunctionalTests extends TestCase {
3939
public static TestSuite suite() {
4040
TestSuite suite = new TestSuite("functional");
41+
suite.addTestSuite(Heartbeat.class);
4142
suite.addTestSuite(Tables.class);
4243
suite.addTestSuite(DoubleDeletion.class);
4344
suite.addTestSuite(Routing.class);
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// The contents of this file are subject to the Mozilla Public License
2+
// Version 1.1 (the "License"); you may not use this file except in
3+
// compliance with the License. You may obtain a copy of the License at
4+
// http://www.mozilla.org/MPL/
5+
//
6+
// Software distributed under the License is distributed on an "AS IS"
7+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
8+
// License for the specific language governing rights and limitations
9+
// under the License.
10+
//
11+
// The Original Code is RabbitMQ.
12+
//
13+
// The Initial Developers of the Original Code are LShift Ltd,
14+
// Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
15+
//
16+
// Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
17+
// Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
18+
// are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
19+
// Technologies LLC, and Rabbit Technologies Ltd.
20+
//
21+
// Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
22+
// Ltd. Portions created by Cohesive Financial Technologies LLC are
23+
// Copyright (C) 2007-2010 Cohesive Financial Technologies
24+
// LLC. Portions created by Rabbit Technologies Ltd are Copyright
25+
// (C) 2007-2010 Rabbit Technologies Ltd.
26+
//
27+
// All Rights Reserved.
28+
//
29+
// Contributor(s): ______________________________________.
30+
//
31+
32+
package com.rabbitmq.client.test.functional;
33+
34+
import java.io.IOException;
35+
36+
import com.rabbitmq.client.impl.AMQConnection;
37+
import com.rabbitmq.client.test.BrokerTestCase;
38+
39+
public class Heartbeat extends BrokerTestCase {
40+
41+
public Heartbeat()
42+
{
43+
super();
44+
connectionFactory.setRequestedHeartbeat(1);
45+
}
46+
47+
public void testHeartbeat()
48+
throws IOException, InterruptedException
49+
{
50+
Thread.sleep(3100);
51+
assertTrue(connection.isOpen());
52+
((AMQConnection)connection).setHeartbeat(0);
53+
Thread.sleep(3100);
54+
assertFalse(connection.isOpen());
55+
56+
}
57+
58+
}

0 commit comments

Comments
 (0)