DefaultDispatcher implements Dispatcher { @Override public boolean forceDispatch() { if (!launch()) { mRetryCounter = 0; mSleepToken.release(); return false; } return true; } DefaultDispatcher(EventCache eventCache, Connectivity connectivity, PacketFactory packetFactory, PacketSender packetSender); @Override int getConnectionTimeOut(); @Override void setConnectionTimeOut(int timeOut); @Override void setDispatchInterval(long dispatchInterval); @Override long getDispatchInterval(); @Override void setDispatchGzipped(boolean dispatchGzipped); @Override boolean getDispatchGzipped(); @Override void setDispatchMode(DispatchMode dispatchMode); @Override DispatchMode getDispatchMode(); @Override boolean forceDispatch(); @Override void forceDispatchBlocking(); @Override void clear(); @Override void submit(TrackMe trackMe); @Override void setDryRunTarget(List<Packet> dryRunTarget); @Override List<Packet> getDryRunTarget();  }
@Test public void testForceDispatch() throws Exception { List<Packet> dryRunData = Collections.synchronizedList(new ArrayList<Packet>()); mDispatcher.setDryRunTarget(dryRunData); mDispatcher.setDispatchInterval(-1L); final int threadCount = 10; final int queryCount = 10; final List<String> createdEvents = Collections.synchronizedList(new ArrayList<String>()); launchTestThreads(mApiUrl, mDispatcher, threadCount, queryCount, createdEvents); TestHelper.sleep(500); assertEquals(threadCount * queryCount, createdEvents.size()); assertEquals(0, dryRunData.size()); mDispatcher.forceDispatch(); checkForMIAs(threadCount * queryCount, createdEvents, dryRunData); }