| 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"; |
| 11 import "dart:io"; |
| 12 |
| 13 import "package:async_helper/async_helper.dart"; |
| 10 import "package:expect/expect.dart"; | 14 import "package:expect/expect.dart"; |
| 11 import "package:path/path.dart"; | 15 import "package:path/path.dart"; |
| 12 import "dart:async"; | |
| 13 import "dart:io"; | |
| 14 import "dart:isolate"; | |
| 15 | 16 |
| 16 const HOST_NAME = "localhost"; | 17 const HOST_NAME = "localhost"; |
| 17 const CERTIFICATE = "localhost_cert"; | 18 const CERTIFICATE = "localhost_cert"; |
| 18 | 19 |
| 19 // This test sends corrupt data in the middle of a secure network connection. | 20 // This test sends corrupt data in the middle of a secure network connection. |
| 20 // This tests the error handling of RawSecureSocket. | 21 // This tests the error handling of RawSecureSocket. |
| 21 // A RawSocket connection is upgraded to a secure connection, so that we | 22 // A RawSocket connection is upgraded to a secure connection, so that we |
| 22 // have a reference to the underlying socket. Then we send some | 23 // have a reference to the underlying socket. Then we send some |
| 23 // unencrypted data on it, in the middle of an encrypted data transfer. | 24 // unencrypted data on it, in the middle of an encrypted data transfer. |
| 24 | 25 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 return connectClient(server.port, hostnameInConnect).then(runClient); | 155 return connectClient(server.port, hostnameInConnect).then(runClient); |
| 155 }); | 156 }); |
| 156 } | 157 } |
| 157 | 158 |
| 158 | 159 |
| 159 main() { | 160 main() { |
| 160 String certificateDatabase = join(dirname(Platform.script), 'pkcert'); | 161 String certificateDatabase = join(dirname(Platform.script), 'pkcert'); |
| 161 SecureSocket.initialize(database: certificateDatabase, | 162 SecureSocket.initialize(database: certificateDatabase, |
| 162 password: 'dartdart', | 163 password: 'dartdart', |
| 163 useBuiltinRoots: false); | 164 useBuiltinRoots: false); |
| 164 var keepAlive = new ReceivePort(); | 165 asyncStart(); |
| 165 Future.wait([test(false), test(true)]) | 166 Future.wait([test(false), test(true)]) |
| 166 .then((_) => keepAlive.close()); | 167 .then((_) => asyncEnd()); |
| 167 } | 168 } |
| OLD | NEW |