assertEquals(1, q.size());
}
@Test
public void testPoll() throws IOException {
final IQueue q = getQueue();
final SimpleClient client = getClient();
client.send(new PollRequest(queueName));
Object result = client.receive();
assertNull(result);
q.offer("item1");
client.send(new PollRequest(queueName));
result = client.receive();
assertEquals("item1", result);
assertEquals(0, q.size());
new Thread() {
public void run() {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
q.offer("item2");
}
}.start();
client.send(new PollRequest(queueName, 10 * 1000));
result = client.receive();
assertEquals("item2", result);
assertEquals(0, q.size());
}