use of org.apache.activemq.artemis.core.protocol.hornetq.client.HornetQClientProtocolManagerFactory in project activemq-artemis by apache.
the class HQClientProtocolManagerTest method testNoCheckFailoverMessage.
@Test
public void testNoCheckFailoverMessage() throws Exception {
final int pingPeriod = 1000;
ActiveMQServer server = createServer(false, true);
server.start();
ClientSessionInternal session = null;
try {
ServerLocator locator = createFactory(true).setClientFailureCheckPeriod(pingPeriod).setRetryInterval(500).setRetryIntervalMultiplier(1d).setReconnectAttempts(-1).setConfirmationWindowSize(1024 * 1024);
locator.setProtocolManagerFactory(new HornetQClientProtocolManagerFactory());
ClientSessionFactory factory = createSessionFactory(locator);
session = (ClientSessionInternal) factory.createSession();
server.stop();
Thread.sleep((pingPeriod * 2));
List<String> incomings = server.getConfiguration().getIncomingInterceptorClassNames();
incomings.add(UnsupportedPacketInterceptor.class.getName());
server.start();
// issue a query to make sure session is reconnected.
ClientSession.QueueQuery query = session.queueQuery(new SimpleString("anyvalue"));
assertFalse(query.isExists());
locator.close();
UnsupportedPacketInterceptor.checkReceivedTypes();
} finally {
try {
session.close();
} catch (Throwable e) {
}
server.stop();
}
}
Aggregations