| 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"; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 void testSimpleConnectFail(String certificate, bool cancelOnError) { | 81 void testSimpleConnectFail(String certificate, bool cancelOnError) { |
| 82 ReceivePort port = new ReceivePort(); | 82 ReceivePort port = new ReceivePort(); |
| 83 RawSecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) { | 83 RawSecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) { |
| 84 var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port) | 84 var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port) |
| 85 .then((clientEnd) { | 85 .then((clientEnd) { |
| 86 Expect.fail("No client connection expected."); | 86 Expect.fail("No client connection expected."); |
| 87 }) | 87 }) |
| 88 .catchError((error) { | 88 .catchError((error) { |
| 89 Expect.isTrue(error is SocketException); | 89 Expect.isTrue(error is HandshakeException); |
| 90 }); | 90 }); |
| 91 server.listen((serverEnd) { | 91 server.listen((serverEnd) { |
| 92 Expect.fail("No server connection expected."); | 92 Expect.fail("No server connection expected."); |
| 93 }, | 93 }, |
| 94 onError: (error) { | 94 onError: (error) { |
| 95 Expect.isTrue(error is SocketException); | 95 Expect.isTrue(error is CertificateException); |
| 96 clientEndFuture.then((_) { | 96 clientEndFuture.then((_) { |
| 97 if (!cancelOnError) server.close(); | 97 if (!cancelOnError) server.close(); |
| 98 port.close(); | 98 port.close(); |
| 99 }); | 99 }); |
| 100 }, | 100 }, |
| 101 cancelOnError: cancelOnError); | 101 cancelOnError: cancelOnError); |
| 102 }); | 102 }); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void testServerListenAfterConnect() { | 105 void testServerListenAfterConnect() { |
| (...skipping 412 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 |