BundleServerServiceImpl implements BundleServerService, ServletContextAware { @Override public String start(String instanceId) { if (!_isAws) { return LOCAL_HOST; } if (LOCAL_HOST.equalsIgnoreCase(instanceId)) { return instanceId; } List<String> instances = new ArrayList<String>(); instances.add(instanceId); StartInstancesRequest startInstancesRequest = new StartInstancesRequest(instances); StartInstancesResult startInstancesResult = _ec2.startInstances(startInstancesRequest); InstanceStateChange change = null; if (!startInstancesResult.getStartingInstances().isEmpty()) { change = startInstancesResult.getStartingInstances().get(0); _log.info("from state=" + change.getPreviousState() + " to state=" + change.getCurrentState()); return change.getInstanceId(); } return null; }  @Override void setEc2User(String user); @Override void setEc2Password(String password); @PostConstruct @Override void setup(); @Override void setServletContext(ServletContext servletContext); @Override String start(String instanceId); String pollPublicDns(String instanceId, int maxWaitSeconds); @Override String findPublicDns(String instanceId); @Override String findPublicIp(String instanceId); @Override String stop(String instanceId); @Override boolean ping(String instanceId); @Override T makeRequest(String instanceId, String apiCall, Object payload, Class<T> returnType, int waitTimeInSeconds, Map params, String sessionId); @Override T makeRequest(String instanceId, String apiCall, Object payload, Class<T> returnType, int waitTimeInSeconds, Map params); @Override T makeRequest(String instanceId, String apiCall, Object payload, Class<T> returnType, int waitTimeInSeconds); @Autowired void setRemoteConnectionService(
			RemoteConnectionService remoteConnectionService);  }
@Test public void testStart() throws Exception { String instanceId = serverService.start("i-instance"); long start = System.currentTimeMillis(); String dns = serverService.pollPublicDns(instanceId, 60); long end = System.currentTimeMillis(); _log.debug("found dns=" + dns + " after " + (end-start)/1000 + " seconds"); String ip = serverService.findPublicIp(instanceId); _log.debug("found ip=" + ip); assertNotNull(ip); start = System.currentTimeMillis(); int count = 0; while (!serverService.ping(instanceId) && count < 60) { Thread.sleep(1000); count++; } end = System.currentTimeMillis(); _log.debug("ping=" + serverService.ping(instanceId) + " after " + (end-start)/1000 + " seconds"); serverService.stop(instanceId); }