### Question:
SyncProcedure { public List<PresenceItem> getResponse() { return (mRosterCount >= 0) ? mResponse : null; } SyncProcedure(List<String> jidList, Object notifyTo); @Subscribe(sticky = true, threadMode = ThreadMode.BACKGROUND) synchronized void onConnected(ConnectedEvent event); @Subscribe(sticky = true, threadMode = ThreadMode.BACKGROUND) synchronized void onDisconnected(DisconnectedEvent event); @Subscribe(threadMode = ThreadMode.BACKGROUND) synchronized void onPresence(PresenceEvent event); @Subscribe(threadMode = ThreadMode.BACKGROUND) synchronized void onRosterMatch(RosterMatchEvent event); @Subscribe(threadMode = ThreadMode.BACKGROUND) synchronized void onBlocklist(BlocklistEvent event); @Subscribe(threadMode = ThreadMode.BACKGROUND) synchronized void onLastActivity(LastActivityEvent event); @Subscribe(threadMode = ThreadMode.BACKGROUND) synchronized void onPublicKey(PublicKeyEvent event); List<PresenceItem> getResponse();  }### Answer:
@Test public void testNiceSync() throws InterruptedException { TestNiceSyncListener listener = new TestNiceSyncListener(); mBus.register(listener); mBus.postSticky(new ConnectedEvent()); synchronized (this) { wait(3000); } mBus.unregister(listener); SyncProcedure.PresenceItem alice = new SyncProcedure.PresenceItem(); alice.from = JidCreate.bareFromOrThrowUnchecked("alice@prime.kontalk.net"); alice.matched = true; alice.presence = true; alice.blocked = false; alice.discarded = false; alice.rosterName = "alice"; alice.status = null; alice.timestamp = -1; SyncProcedure.PresenceItem bob = new SyncProcedure.PresenceItem(); bob.from = JidCreate.bareFromOrThrowUnchecked("bob@prime.kontalk.net"); bob.matched = true; bob.presence = true; bob.blocked = false; bob.discarded = false; bob.rosterName = "bob"; bob.status = null; bob.timestamp = -1; assertThat(mSync.getResponse(), hasItems( alice, bob )); }
@Test public void testConnectionBombing() throws InterruptedException { TestNiceSyncListener listener = new TestNiceSyncListener(); mBus.register(listener); for (int i = 0; i < 10; i++) { mBus.postSticky(new ConnectedEvent()); Thread.sleep(50); } mBus.post(new DisconnectedEvent()); synchronized (this) { wait(3000); } mBus.unregister(listener); assertNull(mSync.getResponse()); }