Assert.assertEquals(new XInteger(5), engine.poll(request2));
}
@Test
public void testExecuteQueryPollOutOfOrder() throws RemoteException, InterruptedException {
XQEngine engine = new XQEngineClient("//" + bindHost + ":1099/xbird/srv-01");
QueryRequest request1 = new QueryRequest("1+2", ReturnType.STRING);
request1.setReplyPattern(ReplyPattern.POLL);
// not send
Assert.assertNull(engine.poll(request1));
// send#2
QueryRequest request2 = new QueryRequest("1+4");
request2.setReplyPattern(ReplyPattern.POLL);
Assert.assertNull(engine.execute(request2));
// send#1
Assert.assertNull(engine.execute(request1));
// poll#1
Thread.sleep(3000);
Assert.assertEquals("3", engine.poll(request1));
// after polled
Assert.assertNull(engine.poll(request1));
// poll#2
Thread.sleep(3000);
Assert.assertEquals(new XInteger(5), engine.poll(request2));
}