@Test
	public void testActionRefreshMemory() throws Exception {
		DebuggerControlService controlService = addPlugin(tool, DebuggerControlServicePlugin.class);
		assertFalse(listingProvider.actionRefreshSelectedMemory.isEnabled());
		runSwing(() -> listingProvider.setAutoReadMemorySpec(readNone));

		createAndOpenTrace();
		try (Transaction tx = tb.startTransaction()) {
			tb.trace.getObjectManager().createRootObject(SCHEMA_SESSION);
			tb.createObjectsProcessAndThreads();
			tb.trace.getMemoryManager()
					.addRegion("Processes[1].Memory[exe:.text]", Lifespan.nowOn(0),
						tb.range(0x55550000, 0x5555ffff),
						TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
		}
		waitForDomainObject(tb.trace);
		TraceObject process = tb.obj("Processes[1]");
		traceManager.activateTrace(tb.trace);
		waitForSwing();
		controlService.setCurrentMode(tb.trace, ControlMode.RO_TARGET);
		waitForSwing();
		assertFalse(listingProvider.actionRefreshSelectedMemory.isEnabled());

		createRmiConnection();
		addMemoryMethods();
		rmiCx.publishTarget(tool, tb.trace);
		waitForSwing();
		// Action no longer requires a selection. It uses visible memory.
		assertTrue(listingProvider.actionRefreshSelectedMemory.isEnabled());

		assertTrue(rmiMethodReadMem.argQueue().isEmpty());

		performAction(listingProvider.actionRefreshSelectedMemory, false);
		handleReadMemInvocation(process, tb.range(0x55550000, 0x55550fff));

		rmiCx.setLastSnapshot(tb.trace, 1);
		traceManager.activateSnap(1);
		waitForSwing();
		controlService.setCurrentMode(tb.trace, ControlMode.RO_TRACE);
		traceManager.activateSnap(0);
		waitForSwing();
		assertFalse(listingProvider.actionRefreshSelectedMemory.isEnabled());

		traceManager.activateSnap(1);
		waitForSwing();
		assertTrue(listingProvider.actionRefreshSelectedMemory.isEnabled());

		rmiCx.withdrawTarget(tool, tb.trace);
		waitForSwing();
		assertFalse(listingProvider.actionRefreshSelectedMemory.isEnabled());
	}
Because goToDyn has to retry, it can generate many read requests. Turn off auto-read and
then flush out any pending reads, so that all the tasks can complete.
Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProviderTest.java