def connect_to_process!
      Bullring.logger.debug{"#{caller_name}: Connecting to process..."}

      if !process_port_active?
        Bullring.logger.debug {"#{caller_name}: Spawning process..."}

        # Spawn the process in its own process group so it stays alive even if this process dies
        pid = Process.spawn([@options[:process][:command], @options[:process][:args]].flatten.join(" "), {:pgroup => true})
        Process.detach(pid)

        time_sleeping = 0
        while (!process_port_active?)
          sleep(0.2)
          if (time_sleeping += 0.2) > @options[:process][:max_bringup_time]
            Bullring.logger.error {"#{caller_name}: Timed out waiting to bring up the process"}
            raise StandardError, "#{caller_name}: Timed out waiting to bring up the process", caller
          end
        end
      end

      if !@local_service.nil?
        @local_service.stop_service
        Bullring.logger.debug {"#{caller_name}: Stopped local service on #{@local_service.uri}"}
      end
      
      @local_service = DRb.start_service "druby://127.0.0.1:0"
      Bullring.logger.debug {"#{caller_name}: Started local service on #{@local_service.uri}"}

      @process = DRbObject.new nil, "druby://#{host}:#{port}"
      
      @after_connect_block.call(@process) if !@after_connect_block.nil?
    end
def connect_to_process!
      Bullring.logger.debug{"#{caller_name}: Connecting to process..."}

      if !process_port_active?
        Bullring.logger.debug {"#{caller_name}: Spawning process..."}

        # Spawn the process in its own process group so it stays alive even if this process dies
        pid = Process.spawn([@options[:process][:command], @options[:process][:args]].flatten.join(" "), {:pgroup => true})
        Process.detach(pid)

        time_sleeping = 0
        while (!process_port_active?)
          sleep(0.2)
          if (time_sleeping += 0.2) > @options[:process][:max_bringup_time]
            Bullring.logger.error {"#{caller_name}: Timed out waiting to bring up the process"}
            raise StandardError, "#{caller_name}: Timed out waiting to bring up the process", caller
          end
        end
      end

      if !@local_service.nil?
        @local_service.stop_service
        Bullring.logger.debug {"#{caller_name}: Stopped local service on #{@local_service.uri}"}
      end
      
      @local_service = DRb.start_service "druby://127.0.0.1:0"
      Bullring.logger.debug {"#{caller_name}: Started local service on #{@local_service.uri}"}

      @process = DRbObject.new nil, "druby://#{host}:#{port}"
      
      @after_connect_block.call(@process) if !@after_connect_block.nil?
    end
Creates a druby connection to the process, starting it up if necessary