Add timeout test, fix race condition onSubscribe