These are just simple examples which run for 60s seconds for demonstration purposes.
The sleep(6000) is there to put the main thread to sleep for 60s, to stop the application exiting immediately - which allows time for some data to be received via the onRefresh / onUpdate callback methods on the API Thread context.
You just need to stop the application from exiting after 60s to continue receiving data on the API thread.
So, for example you could just put a while loop around the sleep(6000) so that it keeps sleeping - indefinitely. OR just increase the sleep time if you want it to run for a bit longer before exiting.