src/main/java/org/jivesoftware/smack/PacketCollector.java
public Packet nextResult(long timeout) {
        try {
            return resultQueue.poll(timeout, TimeUnit.MILLISECONDS);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
public Packet nextResult(long timeout) {
        try {
            return resultQueue.poll(timeout, TimeUnit.MILLISECONDS);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
Returns the next available packet. The method call will block (not
return) until a packet is available or the <tt>timeout</tt> has elapased.
If the timeout elapses without a result, <tt>null</tt> will be returned.

@param timeout
the amount of time to wait for the next packet (in
milleseconds).
@return the next available packet.