@Test
public void emptyRemoteExceptionTest() throws Exception {

    ShadowApplication application = ShadowApplication.getInstance();
    ComponentName componentName = new ComponentName(application.getApplicationContext(), ActorService.class);
    IBinder binder = Mockito.mock(IBinder.class);
    Mockito.doThrow(new RemoteException()).when(binder).getInterfaceDescriptor();
    ServiceActorThread thread = new ServiceActorThread(application.getApplicationContext(), mProxyFactory,
            mFailureHandler, ActorService.class, 1);
    ActorRef<Runnable> ref = thread.bind(Runnable.class, mActorImpl);
    Assert.assertSame(mProxy, ref.tell());
    ArgumentCaptor<MessageSender> postmanCaptor = ArgumentCaptor.forClass(MessageSender.class);
    Mockito.verify(mProxyFactory).newProxy(Mockito.<Class>any(), postmanCaptor.capture());
    MessageSender postman = postmanCaptor.getValue();
    Assert.assertNotNull(postman);
    // Set null as local interface, it should cause service restart
    ((ServiceConnection) postman).onServiceConnected(componentName, binder);
    // Should attempt to stop service
    Intent intent = application.getNextStoppedService();
    Assert.assertNotNull(intent);
    Assert.assertEquals(new ComponentName(application.getApplicationContext(), ActorService.class),
            intent.getComponent());
    // And start it again
    intent = application.getNextStartedService();
    Assert.assertNotNull(intent);
    Assert.assertEquals(new ComponentName(application.getApplicationContext(), ActorService.class),
            intent.getComponent());
    // Second call should just stop service
    application.clearStartedServices();
    ((ServiceConnection) postman).onServiceConnected(componentName, binder);
    // Should attempt to stop service
    intent = application.getNextStoppedService();
    Assert.assertNotNull(intent);
    Assert.assertEquals(new ComponentName(application.getApplicationContext(), ActorService.class),
            intent.getComponent());
    intent = application.getNextStartedService();
    Assert.assertNull(intent);
}