title: Jenkins Pipeline loop ends unexpectedly
body: <p>I am trying to verify that all my web applications in one tomcat are running after execution of Jenkins pipeline.</p>
  
  <p>I am verifing more than one url so I want to do that in for loop.
  It ends on first url in collection.</p>
  
  <p>Here is my code</p>
  
  <pre><code>@NonCPS
  def verifyServices(list) {
      echo "Services: "+list.size()
      def result = true
      for(int i = 0; i &lt; list.size(); i++){
          if(result) {
              result = testUrl(list[i])
          }
      }
      return result
  }
  
  def verify = []
  verify.add("http://example.com:8082")
  verify.add("http://example.com:8082/rest/version")
  verify.add("http://example.com:8082/mobile/version")
  verifyServices(verify)
  </code></pre>
  
  <p>And testUrl function</p>
  
  <pre><code>def call(urlString) {
      echo "Testing ${urlString}"
      def url = new URL(urlString)
      def HttpURLConnection connection = url.openConnection()
      connection.setRequestMethod("GET")
      connection.setDoInput(true)
  
      try {
          connection.connect()
          def code = connection.getResponseCode()
          echo "Response code ${code}"
          return code == 200
      } finally {
          connection.disconnect()
      }
  }
  </code></pre>
  
  <p>Here is my log</p>
  
  <pre><code>Proceeding
  [Pipeline] echo
  Services: 3
  [Pipeline] echo
  Testing http://example.com:8082
  [Pipeline] echo
  Response code 200
  [Pipeline] }
  [Pipeline] // node
  [Pipeline] End of Pipeline
  </code></pre>
  
  <p>When I remove call to <code>testUrl</code> function in <code>verifyServices</code> it iterates over all of them.</p>
  
  <p>Am I doing something wrong? Or for loops are just broken?</p>