| 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 String localFile(path) => Platform.script.resolve(path).toFilePath(); | 17 String localFile(path) => Platform.script.resolve(path).toFilePath(); |
| 18 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync(); | 18 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync(); |
| 19 | 19 |
| 20 SecurityContext serverContext = new SecurityContext() | 20 SecurityContext serverContext = new SecurityContext() |
| 21 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem')) | 21 ..useCertificateChainSync(localFile('certificates/server_chain.pem')) |
| 22 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'), | 22 ..usePrivateKeySync(localFile('certificates/server_key.pem'), |
| 23 password: 'dartdart'); | 23 password: 'dartdart'); |
| 24 | 24 |
| 25 SecurityContext clientContext = new SecurityContext() | 25 SecurityContext clientContext = new SecurityContext() |
| 26 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); | 26 ..setTrustedCertificatesSync(localFile('certificates/trusted_certs.pem')); |
| 27 | 27 |
| 28 // This test creates a server and a client connects. After connecting | 28 // This test creates a server and a client connects. After connecting |
| 29 // and an optional initial handshake the connection is secured by | 29 // and an optional initial handshake the connection is secured by |
| 30 // upgrading to a secure connection The client then writes and the | 30 // upgrading to a secure connection The client then writes and the |
| 31 // server echos. When the server has finished its echo it | 31 // server echos. When the server has finished its echo it |
| 32 // half-closes. When the client gets the close event is closes fully. | 32 // half-closes. When the client gets the close event is closes fully. |
| 33 // | 33 // |
| 34 // The test can be run in different configurations based on | 34 // The test can be run in different configurations based on |
| 35 // the boolean arguments: | 35 // the boolean arguments: |
| 36 // | 36 // |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 test(false, false); | 231 test(false, false); |
| 232 // TODO(whesse): Enable the test with all argument combinations: | 232 // TODO(whesse): Enable the test with all argument combinations: |
| 233 // test(true, false); | 233 // test(true, false); |
| 234 // test(false, true); | 234 // test(false, true); |
| 235 // test(true, true); | 235 // test(true, true); |
| 236 // test(false, true, true); | 236 // test(false, true, true); |
| 237 // test(true, true, true); | 237 // test(true, true, true); |
| 238 asyncEnd(); | 238 asyncEnd(); |
| 239 }); | 239 }); |
| 240 } | 240 } |
| OLD | NEW |