code: public List<InstanceStateChangeType> stopInstances(final Set<String> instanceIDs) {
  
          List<InstanceStateChangeType> ret = new ArrayList<InstanceStateChangeType>();
  
          Collection<AbstractMockEc2Instance> instances = getInstances(instanceIDs);
          for (AbstractMockEc2Instance instance : instances) {
              if (null != instance) {
                  InstanceStateChangeType stateChange = new InstanceStateChangeType();
                  stateChange.setInstanceId(instance.getInstanceID());
  
                  InstanceStateType previousState = new InstanceStateType();
                  previousState.setCode(instance.getInstanceState().getCode());
                  previousState.setName(instance.getInstanceState().getName());
                  stateChange.setPreviousState(previousState);
  
                  instance.stop();
  
                  InstanceStateType newState = new InstanceStateType();
                  newState.setCode(instance.getInstanceState().getCode());
                  newState.setName(instance.getInstanceState().getName());
                  stateChange.setCurrentState(newState);
  
                  ret.add(stateChange);
              }
          }
  
          return ret;
  
      }
docs: Stop one or more existing mock ec2 instances.
  
  @param instanceIDs
  a set of instance IDs for those instances to stop
  @return a list of state change messages (typically running to stopping)