@SuppressWarnings("unchecked")
@Test
public void sendTransaction_sendToHandler_anotherThreadCreatedNewHandler() {

    DefaultActorThread thread = createThread();
    ActorHandlerBase handler = createHandler(-1, null);
    // It will mimic new handler creation
    Mockito.doReturn(false, true).when(handler).sendTransaction(Mockito.<Transaction>any());
    thread.mHandler = handler;
    Transaction transaction = Transaction.<Object>obtain(mImpl, mMessage, mFailureHandler);
    thread.sendTransaction(transaction);
    Mockito.verify(handler, Mockito.times(2)).sendTransaction(transaction);
    Assert.assertSame(handler, thread.mHandler);
}