title: NSURLConnection sendSynchronousRequest seems to hang
body: <p>This HTTP call seems to be hanging and I can't see why. The logging line after the call never runs. </p>
  
  <p>I'm almost certainly doing something extremely stupid, but if anyone can spot what it is I'd be grateful. As far as I can see my code is equivalent to the docs. </p>
  
  <p>It doesn't seem to matter what URL I use, and the HTTP request is never logged by the server (if pointed at one).</p>
  
  <pre><code>NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com/"]];
  
  NSURLResponse *res = nil;
  NSError *err = nil;
  
  NSLog(@"About to send req %@",req.URL);
  
  NSData *data = [NSURLConnection sendSynchronousRequest:req returningResponse:&amp;res error:&amp;err];
  
  NSLog(@"this never runs");
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p><strong>Update</strong></p>
  
  <p>Thanks to everyone who's posted so far. Still seeing the problem. A bit more detail:</p>
  
  <ul>
  <li>The code is being tested on the device</li>
  <li>Other HTTP calls work fine so if it's a network problem it's a non-trivial one</li>
  <li>The code has hung well past the normal timeout. I know it hangs for over 20 minutes. I killed it at that point, but I assume it would continue to hang.</li>
  <li>I'm not currently using a delegate and don't plan to, see below.</li>
  <li>In other places in the app I use <code>sendAynchronousRequest</code> but in this instance I need to pass a return value (and I'm not on the main thread), so <code>sendSynchronousRequest</code> is the only option I know of.</li>
  <li>In case it matters, the context is that I'm implementing the <code>NSURLCache</code> protocol, specifically the <code>cachedResponseForRequest</code> method, which requires I return a <code>NSCachedURLResponse</code> </li>
  </ul>