HystrixContextScheduler extends Scheduler { @Override public Worker createWorker() { return new HystrixContextSchedulerWorker(actualScheduler.createWorker()); } HystrixContextScheduler(Scheduler scheduler);  HystrixContextScheduler(HystrixConcurrencyStrategy concurrencyStrategy, Scheduler scheduler);  HystrixContextScheduler(HystrixConcurrencyStrategy concurrencyStrategy, HystrixThreadPool threadPool);  HystrixContextScheduler(HystrixConcurrencyStrategy concurrencyStrategy, HystrixThreadPool threadPool, Func0<Boolean> shouldInterruptThread); @Override Worker createWorker();  }
@Test(timeout = 2500) public void testUnsubscribeWrappedScheduler() throws InterruptedException { Scheduler s = Schedulers.newThread(); final AtomicBoolean interrupted = new AtomicBoolean(); final CountDownLatch start = new CountDownLatch(1); final CountDownLatch end = new CountDownLatch(1); HystrixContextScheduler hcs = new HystrixContextScheduler(s); Scheduler.Worker w = hcs.createWorker(); try { w.schedule(new Action0() { @Override public void call() { start.countDown(); try { try { Thread.sleep(5000); } catch (InterruptedException ex) { interrupted.set(true); } } finally { end.countDown(); } } }); start.await(); w.unsubscribe(); end.await(); assertTrue(interrupted.get()); } finally { w.unsubscribe(); } }