    @Test
    public void testDetect() {

        Flowable<Integer> mockClicks = Flowable
                .create(emitter -> {
                    emitter.onNext(1);
                    sleepSilently(50);
                    emitter.onNext(1);
                    sleepSilently(50);
                    emitter.onNext(1);
                    sleepSilently(50);
                    emitter.onNext(1);

                    sleepSilently(150);

                    emitter.onNext(1);
                    sleepSilently(50);
                    emitter.onNext(1);

                    sleepSilently(150);
                    emitter.onNext(1);

                    sleepSilently(150);
                    emitter.onNext(1);

                    emitter.onComplete();
                }, BackpressureStrategy.BUFFER);

        TestSubscriber<Integer> subscriber = new TestSubscriber<>();
        RxComboDetector.detect(mockClicks, 100, 2)
                .subscribeOn(Schedulers.from(command -> new Thread(command).start()))
                .subscribe(subscriber);

        subscriber.awaitTerminalEvent(30, TimeUnit.SECONDS);
        subscriber.assertValueCount(4);
        subscriber.assertValues(2, 3, 4, 2);
    }