ArgumentCaptor<Address> capturedAddress = ArgumentCaptor.forClass(Address.class);
when(this.cache.getAdvancedCache()).thenReturn(this.cache);
when(this.cache.getDistributionManager()).thenReturn(distManager);
when(distManager.getLocality(sessionId)).thenReturn(DataLocality.NOT_LOCAL);
when(distManager.locate(same(sessionId))).thenReturn(addresses);
when(this.cache.getCacheManager()).thenReturn(container);
when(container.getAddress()).thenReturn(localAddress);
when(this.registry.getRemoteEntry(capturedAddress.capture())).thenReturn(new AbstractMap.SimpleImmutableEntry<String, Void>(expected, null));
when(this.cache.withFlags(Flag.FORCE_SYNCHRONOUS)).thenReturn(this.cache);