OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // VMOptions= | 5 // VMOptions= |
6 // VMOptions=--short_socket_read | 6 // VMOptions=--short_socket_read |
7 // VMOptions=--short_socket_write | 7 // VMOptions=--short_socket_write |
8 // VMOptions=--short_socket_read --short_socket_write | 8 // VMOptions=--short_socket_read --short_socket_write |
9 | 9 |
10 import "dart:async"; | 10 import "dart:async"; |
11 import "dart:io"; | 11 import "dart:io"; |
12 | 12 |
13 import "package:async_helper/async_helper.dart"; | 13 import "package:async_helper/async_helper.dart"; |
14 import "package:expect/expect.dart"; | 14 import "package:expect/expect.dart"; |
15 | 15 |
16 InternetAddress HOST; | 16 InternetAddress HOST; |
17 | 17 |
18 String localFile(path) => Platform.script.resolve(path).toFilePath(); | 18 String localFile(path) => Platform.script.resolve(path).toFilePath(); |
19 | 19 |
20 SecurityContext serverContext = new SecurityContext() | 20 SecurityContext serverContext = new SecurityContext() |
21 ..useCertificateChainSync(localFile('certificates/server_chain.pem')) | 21 ..useCertificateChain(localFile('certificates/server_chain.pem')) |
22 ..usePrivateKeySync(localFile('certificates/server_key.pem'), | 22 ..usePrivateKey(localFile('certificates/server_key.pem'), |
23 password: 'dartdart'); | 23 password: 'dartdart'); |
24 | 24 |
25 SecurityContext clientContext = new SecurityContext() | 25 SecurityContext clientContext = new SecurityContext() |
26 ..setTrustedCertificatesSync(localFile('certificates/trusted_certs.pem')); | 26 ..setTrustedCertificates(localFile('certificates/trusted_certs.pem')); |
27 | 27 |
28 void testSimpleBind() { | 28 void testSimpleBind() { |
29 asyncStart(); | 29 asyncStart(); |
30 SecureServerSocket.bind(HOST, 0, serverContext).then((s) { | 30 SecureServerSocket.bind(HOST, 0, serverContext).then((s) { |
31 Expect.isTrue(s.port > 0); | 31 Expect.isTrue(s.port > 0); |
32 s.close(); | 32 s.close(); |
33 asyncEnd(); | 33 asyncEnd(); |
34 }); | 34 }); |
35 } | 35 } |
36 | 36 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 for (bool cancelOnError in [true, false]) { | 232 for (bool cancelOnError in [true, false]) { |
233 if (server == null || client == null) { | 233 if (server == null || client == null) { |
234 testSimpleConnectFail(server, client, cancelOnError); | 234 testSimpleConnectFail(server, client, cancelOnError); |
235 } | 235 } |
236 } | 236 } |
237 } | 237 } |
238 } | 238 } |
239 testServerListenAfterConnect(); | 239 testServerListenAfterConnect(); |
240 testSimpleReadWrite(); | 240 testSimpleReadWrite(); |
241 } | 241 } |
OLD | NEW |