@Test
public void testThreadRejectedCommand() throws Exception {

    CountDownLatch commandLatch = new CountDownLatch(1);
    CountDownLatch threadPoolLatch = new CountDownLatch(1);
    Subscriber<HystrixCommandCompletion> commandSubscriber = getLatchedSubscriber(commandLatch);
    readCommandStream.observe().take(1).subscribe(commandSubscriber);
    Subscriber<HystrixCommandCompletion> threadPoolSubscriber = getLatchedSubscriber(threadPoolLatch);
    readThreadPoolStream.observe().take(1).subscribe(threadPoolSubscriber);
    ExecutionResult result = ExecutionResult.from(HystrixEventType.THREAD_POOL_REJECTED);
    writeToStream.executionDone(result, commandKey, threadPoolKey);
    assertTrue(commandLatch.await(1000, TimeUnit.MILLISECONDS));
    assertTrue(threadPoolLatch.await(1000, TimeUnit.MILLISECONDS));
}