use of org.apache.activemq.artemis.core.protocol.stomp.v11.StompFrameHandlerV11 in project activemq-artemis by apache.
the class StompV11Test method testHeartBeat3.
@Test
public void testHeartBeat3() throws Exception {
connection.close();
ClientStompFrame frame = conn.createFrame("CONNECT");
frame.addHeader("host", "127.0.0.1");
frame.addHeader("login", this.defUser);
frame.addHeader("passcode", this.defPass);
frame.addHeader("heart-beat", "500,500");
frame.addHeader("accept-version", "1.0,1.1");
ClientStompFrame reply = conn.sendFrame(frame);
assertEquals("CONNECTED", reply.getCommand());
assertEquals("500,500", reply.getHeader("heart-beat"));
System.out.println("========== start pinger!");
conn.startPinger(100);
Assert.assertEquals(1, server.getActiveMQServer().getRemotingService().getConnections().size());
StompConnection stompConnection = (StompConnection) server.getActiveMQServer().getRemotingService().getConnections().iterator().next();
StompFrameHandlerV11 stompFrameHandler = (StompFrameHandlerV11) stompConnection.getStompVersionHandler();
Thread.sleep(1000);
// now check the frame size
int size = conn.getServerPingNumber();
conn.stopPinger();
// ((AbstractStompClientConnection)conn).killReaderThread();
Wait.waitFor(() -> {
return server.getActiveMQServer().getRemotingService().getConnections().size() == 0;
});
Assert.assertFalse(stompFrameHandler.getHeartBeater().isStarted());
}
Aggregations