| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import "dart:io"; | 6 import "dart:io"; |
| 7 import "dart:uri"; | 7 import "dart:uri"; |
| 8 import "dart:isolate"; | 8 import "dart:isolate"; |
| 9 | 9 |
| 10 const SERVER_ADDRESS = "127.0.0.1"; | 10 const SERVER_ADDRESS = "127.0.0.1"; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 response.listen( | 36 response.listen( |
| 37 (_) { }, | 37 (_) { }, |
| 38 onDone: () { | 38 onDone: () { |
| 39 client.close(); | 39 client.close(); |
| 40 clientPort.close(); | 40 clientPort.close(); |
| 41 server.close(); | 41 server.close(); |
| 42 Expect.throws(() => server.port); | 42 Expect.throws(() => server.port); |
| 43 onDone(); | 43 onDone(); |
| 44 }); | 44 }); |
| 45 }) | 45 }) |
| 46 .catchError((error) { | 46 .catchError((e) { |
| 47 Expect.fail("Unexpected error in Https client: $error"); | 47 String msg = "Unexpected error in Https client: $e"; |
| 48 var trace = getAttachedStackTrace(e); |
| 49 if (trace != null) msg += "\nStackTrace: $trace"; |
| 50 Expect.fail(msg); |
| 48 }); | 51 }); |
| 49 }); | 52 }); |
| 50 } | 53 } |
| 51 | 54 |
| 52 // Test two servers in succession. | 55 // Test two servers in succession. |
| 53 test(() { | 56 test(() { |
| 54 test(() { }); | 57 test(() { }); |
| 55 }); | 58 }); |
| 56 } | 59 } |
| 57 | 60 |
| 58 void InitializeSSL() { | 61 void InitializeSSL() { |
| 59 var testPkcertDatabase = | 62 var testPkcertDatabase = |
| 60 new Path(new Options().script).directoryPath.append('pkcert/'); | 63 new Path(new Options().script).directoryPath.append('pkcert/'); |
| 61 SecureSocket.initialize(database: testPkcertDatabase.toNativePath(), | 64 SecureSocket.initialize(database: testPkcertDatabase.toNativePath(), |
| 62 password: 'dartdart'); | 65 password: 'dartdart'); |
| 63 } | 66 } |
| 64 | 67 |
| 65 void main() { | 68 void main() { |
| 66 InitializeSSL(); | 69 InitializeSSL(); |
| 67 testListenOn(); | 70 testListenOn(); |
| 68 } | 71 } |
| OLD | NEW |