| 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 void testSimpleBind() { | 19 void testSimpleBind() { |
| 19 ReceivePort port = new ReceivePort(); | 20 ReceivePort port = new ReceivePort(); |
| 20 RawSecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((s) { | 21 RawSecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((s) { |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 464 |
| 464 if (listenSecure) { | 465 if (listenSecure) { |
| 465 RawSecureServerSocket.bind( | 466 RawSecureServerSocket.bind( |
| 466 HOST_NAME, 0, CERTIFICATE).then(serverReady); | 467 HOST_NAME, 0, CERTIFICATE).then(serverReady); |
| 467 } else { | 468 } else { |
| 468 RawServerSocket.bind(HOST_NAME, 0).then(serverReady); | 469 RawServerSocket.bind(HOST_NAME, 0).then(serverReady); |
| 469 } | 470 } |
| 470 } | 471 } |
| 471 | 472 |
| 472 main() { | 473 main() { |
| 473 Path scriptDir = new Path(Platform.script).directoryPath; | 474 var certificateDatabase = join(dirname(Platform.script), 'pkcert'); |
| 474 Path certificateDatabase = scriptDir.append('pkcert'); | 475 SecureSocket.initialize(database: certificateDatabase, |
| 475 SecureSocket.initialize(database: certificateDatabase.toNativePath(), | |
| 476 password: 'dartdart', | 476 password: 'dartdart', |
| 477 useBuiltinRoots: false); | 477 useBuiltinRoots: false); |
| 478 testSimpleBind(); | 478 testSimpleBind(); |
| 479 testInvalidBind(); | 479 testInvalidBind(); |
| 480 testSimpleConnect(CERTIFICATE); | 480 testSimpleConnect(CERTIFICATE); |
| 481 testSimpleConnect("CN=localhost"); | 481 testSimpleConnect("CN=localhost"); |
| 482 testSimpleConnectFail("not_a_nickname", false); | 482 testSimpleConnectFail("not_a_nickname", false); |
| 483 testSimpleConnectFail("CN=notARealDistinguishedName", false); | 483 testSimpleConnectFail("CN=notARealDistinguishedName", false); |
| 484 testSimpleConnectFail("not_a_nickname", true); | 484 testSimpleConnectFail("not_a_nickname", true); |
| 485 testSimpleConnectFail("CN=notARealDistinguishedName", true); | 485 testSimpleConnectFail("CN=notARealDistinguishedName", true); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 connectSecure: true, | 518 connectSecure: true, |
| 519 handshakeBeforeSecure: false, | 519 handshakeBeforeSecure: false, |
| 520 postponeSecure: false, | 520 postponeSecure: false, |
| 521 dropReads: true); | 521 dropReads: true); |
| 522 testSimpleReadWrite(listenSecure: false, | 522 testSimpleReadWrite(listenSecure: false, |
| 523 connectSecure: false, | 523 connectSecure: false, |
| 524 handshakeBeforeSecure: true, | 524 handshakeBeforeSecure: true, |
| 525 postponeSecure: true, | 525 postponeSecure: true, |
| 526 dropReads: true); | 526 dropReads: true); |
| 527 } | 527 } |
| OLD | NEW |