/**
  * Ensures that the goal state is retrieved.
  * 
  * @return none
  */
 private function _ensureGoalStateRetrieved()
 {
     if (is_null($this->_currentGoalState) || !$this->_keepOpen) {
         $inputStream = $this->_inputChannel->getInputStream($this->_endpoint);
         $this->_goalStateDeserializer->initialize($inputStream);
     }
     $goalState = $this->_goalStateDeserializer->deserialize();
     if (is_null($goalState)) {
         return;
     }
     $this->_currentGoalState = $goalState;
     if (!is_null($goalState->getEnvironmentPath())) {
         $this->_currentEnvironmentData = null;
     }
     $this->_currentStateClient->setEndpoint($this->_currentGoalState->getCurrentStateEndpoint());
     if (!$this->_keepOpen) {
         $this->_inputChannel->closeInputStream();
     }
 }
 /**
  * Sets the current state.
  * 
  * @param CurrentState $state The current state.
  * 
  * @return none
  */
 public function setCurrentState($state)
 {
     $this->_currentStateClient->setCurrentState($state);
 }