| 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 "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| 11 import "package:path/path.dart"; |
| 11 import "dart:async"; | 12 import "dart:async"; |
| 12 import "dart:io"; | 13 import "dart:io"; |
| 13 import "dart:isolate"; | 14 import "dart:isolate"; |
| 14 | 15 |
| 15 const HOST_NAME = "localhost"; | 16 const HOST_NAME = "localhost"; |
| 16 const CERTIFICATE = "localhost_cert"; | 17 const CERTIFICATE = "localhost_cert"; |
| 17 | 18 |
| 18 // This test creates a server and a client connects. After connecting | 19 // This test creates a server and a client connects. After connecting |
| 19 // and an optional initial handshake the connection is secured by | 20 // and an optional initial handshake the connection is secured by |
| 20 // upgrading to a secure connection The client then writes and the | 21 // upgrading to a secure connection The client then writes and the |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 205 |
| 205 connectClient(server.port).then(runClient).then((socket) { | 206 connectClient(server.port).then(runClient).then((socket) { |
| 206 port.close(); | 207 port.close(); |
| 207 }); | 208 }); |
| 208 } | 209 } |
| 209 | 210 |
| 210 ServerSocket.bind(HOST_NAME, 0).then(serverReady); | 211 ServerSocket.bind(HOST_NAME, 0).then(serverReady); |
| 211 } | 212 } |
| 212 | 213 |
| 213 main() { | 214 main() { |
| 214 Path scriptDir = new Path(Platform.script).directoryPath; | 215 var certificateDatabase = join(dirname(Platform.script), 'pkcert'); |
| 215 Path certificateDatabase = scriptDir.append('pkcert'); | 216 SecureSocket.initialize(database: certificateDatabase, |
| 216 SecureSocket.initialize(database: certificateDatabase.toNativePath(), | |
| 217 password: 'dartdart', | 217 password: 'dartdart', |
| 218 useBuiltinRoots: false); | 218 useBuiltinRoots: false); |
| 219 test(false, false); | 219 test(false, false); |
| 220 test(true, false); | 220 test(true, false); |
| 221 test(false, true); | 221 test(false, true); |
| 222 test(true, true); | 222 test(true, true); |
| 223 test(false, true, true); | 223 test(false, true, true); |
| 224 test(true, true, true); | 224 test(true, true, true); |
| 225 } | 225 } |
| OLD | NEW |