@Test public void addAccountCreationListener_MultipleTransactions_SingleEvent() throws Exception { enqueueCreateAccountResponses(); enqueueTransactionsResponses(); final int[] eventsCount = {0}; blockchainEvents.addAccountCreationListener(new EventListener<Void>() { @Override public void onEvent(Void data) { eventsCount[0]++; } }); Thread.sleep(500); assertThat(eventsCount[0], equalTo(1)); }
ListenerRegistration addAccountCreationListener(final EventListener<Void> listener) { checkNotNull(listener, "listener"); final kin.base.requests.EventListener<TransactionResponse> responseListener = new kin.base.requests.EventListener<TransactionResponse>() { private boolean eventOccurred = false; @Override public void onEvent(TransactionResponse transactionResponse) { if (!eventOccurred) { eventOccurred = true; listener.onEvent(null); } } }; transactionsStream.addListener(responseListener); return new ListenerRegistration(new Runnable() { @Override public void run() { transactionsStream.removeListener(responseListener); } }); }
BlockchainEvents { ListenerRegistration addAccountCreationListener(final EventListener<Void> listener) { checkNotNull(listener, "listener"); final kin.base.requests.EventListener<TransactionResponse> responseListener = new kin.base.requests.EventListener<TransactionResponse>() { private boolean eventOccurred = false; @Override public void onEvent(TransactionResponse transactionResponse) { if (!eventOccurred) { eventOccurred = true; listener.onEvent(null); } } }; transactionsStream.addListener(responseListener); return new ListenerRegistration(new Runnable() { @Override public void run() { transactionsStream.removeListener(responseListener); } }); } }
BlockchainEvents { ListenerRegistration addAccountCreationListener(final EventListener<Void> listener) { checkNotNull(listener, "listener"); final kin.base.requests.EventListener<TransactionResponse> responseListener = new kin.base.requests.EventListener<TransactionResponse>() { private boolean eventOccurred = false; @Override public void onEvent(TransactionResponse transactionResponse) { if (!eventOccurred) { eventOccurred = true; listener.onEvent(null); } } }; transactionsStream.addListener(responseListener); return new ListenerRegistration(new Runnable() { @Override public void run() { transactionsStream.removeListener(responseListener); } }); } BlockchainEvents(Server server, String accountId); }
BlockchainEvents { ListenerRegistration addAccountCreationListener(final EventListener<Void> listener) { checkNotNull(listener, "listener"); final kin.base.requests.EventListener<TransactionResponse> responseListener = new kin.base.requests.EventListener<TransactionResponse>() { private boolean eventOccurred = false; @Override public void onEvent(TransactionResponse transactionResponse) { if (!eventOccurred) { eventOccurred = true; listener.onEvent(null); } } }; transactionsStream.addListener(responseListener); return new ListenerRegistration(new Runnable() { @Override public void run() { transactionsStream.removeListener(responseListener); } }); } BlockchainEvents(Server server, String accountId);  }
BlockchainEvents { ListenerRegistration addAccountCreationListener(final EventListener<Void> listener) { checkNotNull(listener, "listener"); final kin.base.requests.EventListener<TransactionResponse> responseListener = new kin.base.requests.EventListener<TransactionResponse>() { private boolean eventOccurred = false; @Override public void onEvent(TransactionResponse transactionResponse) { if (!eventOccurred) { eventOccurred = true; listener.onEvent(null); } } }; transactionsStream.addListener(responseListener); return new ListenerRegistration(new Runnable() { @Override public void run() { transactionsStream.removeListener(responseListener); } }); } BlockchainEvents(Server server, String accountId);   }