@Test
public void testRunnableTraceTokenCopied()
        throws InterruptedException
{

    AtomicReference<TraceToken> actualToken = new AtomicReference<>();
    CountDownLatch latch = new CountDownLatch(1);
    ExecutorService innerExecutor = newSingleThreadExecutor();
    try {
        createAndRegisterNewRequestToken("somekey", "somevalue");
        TraceToken token = getCurrentTraceToken();
        traceTokenCopyingExecutor(innerExecutor).execute(() -> {
            actualToken.set(getCurrentTraceToken());
            latch.countDown();
        });
        assertTrue(latch.await(10, SECONDS));
        assertEquals(actualToken.get(), token);
    }
    finally {
        innerExecutor.shutdown();
    }
}