Version 1.10.0-dev.1.10

svn merge -c 45313 https://dart.googlecode.com/svn/branches/bleeding_edge trunk


git-svn-id: https://dart.googlecode.com/svn/trunk@45369 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/dart/sdk/lib/io/http_impl.dart b/dart/sdk/lib/io/http_impl.dart
index bd382bc..42c1db9 100644
--- a/dart/sdk/lib/io/http_impl.dart
+++ b/dart/sdk/lib/io/http_impl.dart
@@ -1883,7 +1883,11 @@
           // On error, continue with next proxy.
           .catchError(connect);
     }
-    return connect(new HttpException("No proxies given"));
+    // Make sure we go through the event loop before taking a
+    // connection from the pool. For long-running synchronous code the
+    // server might have closed the connection, so this lowers the
+    // probability of getting a connection that was already closed.
+    return new Future(() => connect(new HttpException("No proxies given")));
   }
 
   _SiteCredentials _findCredentials(Uri url, [_AuthenticationScheme scheme]) {
diff --git a/dart/tests/standalone/io/https_bad_certificate_client.dart b/dart/tests/standalone/io/https_bad_certificate_client.dart
index 35edb69..c2f79cd 100644
--- a/dart/tests/standalone/io/https_bad_certificate_client.dart
+++ b/dart/tests/standalone/io/https_bad_certificate_client.dart
@@ -22,7 +22,7 @@
 
 const HOST_NAME = "localhost";
 
-Future runHttpClient(int port, result) {
+Future runHttpClient(int port, result) async {
   bool badCertificateCallback(X509Certificate certificate,
                               String host,
                               int callbackPort) {
@@ -38,17 +38,16 @@
 
   HttpClient client = new HttpClient();
 
-  var testFutures = [];  // The three async getUrl calls run simultaneously.
-  testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
+  await client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
     .then((HttpClientRequest request) {
       expect(result == 'true');  // The session cache may keep the session.
       return request.close();
     }, onError: (e) {
       expect(e is HandshakeException || e is SocketException);
-    }));
+    });
 
   client.badCertificateCallback = badCertificateCallback;
-  testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
+  await client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
     .then((HttpClientRequest request) {
       expect(result == 'true');
       return request.close();
@@ -57,19 +56,21 @@
                                      e is SocketException);
       else if (result == 'exception') expect (e is ExpectException ||
                                               e is SocketException);
-      else expect (e is ArgumentError || e is SocketException);
-    }));
+      else {
+        expect (e is ArgumentError || e is SocketException);
+      }
+    });
 
   client.badCertificateCallback = null;
-  testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
+  await client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
     .then((HttpClientRequest request) {
       expect(result == 'true');  // The session cache may keep the session.
       return request.close();
     }, onError: (e) {
       expect(e is HandshakeException || e is SocketException);
-    }));
+    });
 
-  return Future.wait(testFutures).then((_) => client.close());
+  client.close();
 }
 
 void main(List<String> args) {
diff --git a/dart/tests/standalone/io/https_bad_certificate_test.dart b/dart/tests/standalone/io/https_bad_certificate_test.dart
index e4f7dfb..d07961a 100644
--- a/dart/tests/standalone/io/https_bad_certificate_test.dart
+++ b/dart/tests/standalone/io/https_bad_certificate_test.dart
@@ -27,7 +27,7 @@
   });
 }
 
-void main() {
+main() async {
   var clientScript = Platform.script
                              .resolve('https_bad_certificate_client.dart')
                              .toFilePath();
@@ -46,12 +46,10 @@
     });
   }
 
-  runServer().then((server) {
-    Future.wait([clientProcess(server.port, 'true'),
-                 clientProcess(server.port, 'false'),
-                 clientProcess(server.port, 'fisk'),
-                 clientProcess(server.port, 'exception')]).then((_) {
-      server.close();
-    });
-  });
+  var server = await runServer();
+  await clientProcess(server.port, 'true');
+  await clientProcess(server.port, 'false');
+  await clientProcess(server.port, 'fisk');
+  await clientProcess(server.port, 'exception');
+  server.close();
 }
diff --git a/dart/tools/VERSION b/dart/tools/VERSION
index 6359d8e..0cb079c 100644
--- a/dart/tools/VERSION
+++ b/dart/tools/VERSION
@@ -28,4 +28,4 @@
 MINOR 10
 PATCH 0
 PRERELEASE 1
-PRERELEASE_PATCH 9
+PRERELEASE_PATCH 10