@Nonnull
	@Override
	public WorkspaceRemoteVmResource createRemoteResource(VirtualMachineDescriptor item) throws IOException {
		VirtualMachine virtualMachine = virtualMachineMap.get(item);
		try {
			// Will initialize agent server with default arguments
			Properties properties = virtualMachinePropertiesMap.get(item);
			int port = Discovery.extractPort(properties);
			if (port <= 0) {
				// Port not found, server is not running on remote VM.
				// Load the agent to start it.
				try {
					port = SocketAvailability.findAvailable();
					String agentAbsolutePath = StringUtil.pathToAbsoluteString(getAgentJarPath());
					String agentArgs = "port=" + port+",notrampolines";
					if (DevDetection.isDevEnv())
						agentArgs += ",debug";
					else
						agentArgs += ",namelessThreads";
					virtualMachine.loadAgent(agentAbsolutePath, agentArgs);

					// The agent server will update some properties to indicate its active.
					// We need to update our map so that we can see this indicator so that we can extract
					// the port that the server is running on if we want to reconnect.
					Properties systemProperties = virtualMachine.getSystemProperties();
					virtualMachinePropertiesMap.put(item, systemProperties);
				} catch (AgentLoadException ex) {
					// The agent jar file is written in Java 8. But Recaf uses Java 11+.
					// This is a problem on OUR side because Java 11+ handles agent interactions differently.
					//  - https://stackoverflow.com/a/54454418/
					// Basically in Java 10 they added a prefix string requirement.
					// But the Java 8 VM doesn't have that so our VM will mark it as invalid.
					if (!ex.getMessage().equals("0"))
						// If the result we get back is '0' then that means it was actually a success
						throw ex;
				}
			}

			// Connect with client
			Client client = new Client("localhost", port, ByteBufferAllocator.HEAP, MessageFactory.create());
			return new AgentServerRemoteVmResource(virtualMachine, client);
		} catch (AgentLoadException ex) {
			logger.error("Agent on remote VM '{}' could not be loaded", item, ex);
			throw new IOException("Failed remote load", ex);
		} catch (AgentInitializationException ex) {
			logger.error("Agent on remote VM '{}' crashed on initialization", item, ex);
			throw new IOException("Failed remote initialization", ex);
		} catch (IOException ex) {
			logger.error("IO error when loading agent to remote VM '{}'", item, ex);
			throw ex;
		}
	}
@return Path to agent jar file.
recaf-core/src/main/java/software/coley/recaf/services/attach/BasicAttachManager.java