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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 80 } |
81 | 81 |
82 void testSimpleConnectFail(String certificate, bool cancelOnError) { | 82 void testSimpleConnectFail(String certificate, bool cancelOnError) { |
83 ReceivePort port = new ReceivePort(); | 83 ReceivePort port = new ReceivePort(); |
84 RawSecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) { | 84 RawSecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) { |
85 var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port) | 85 var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port) |
86 .then((clientEnd) { | 86 .then((clientEnd) { |
87 Expect.fail("No client connection expected."); | 87 Expect.fail("No client connection expected."); |
88 }) | 88 }) |
89 .catchError((error) { | 89 .catchError((error) { |
90 Expect.isTrue(error is HandshakeException); | 90 Expect.isTrue(error is SocketException || |
| 91 error is HandshakeException); |
91 }); | 92 }); |
92 server.listen((serverEnd) { | 93 server.listen((serverEnd) { |
93 Expect.fail("No server connection expected."); | 94 Expect.fail("No server connection expected."); |
94 }, | 95 }, |
95 onError: (error) { | 96 onError: (error) { |
96 Expect.isTrue(error is CertificateException); | 97 Expect.isTrue(error is CertificateException); |
97 clientEndFuture.then((_) { | 98 clientEndFuture.then((_) { |
98 if (!cancelOnError) server.close(); | 99 if (!cancelOnError) server.close(); |
99 port.close(); | 100 port.close(); |
100 }); | 101 }); |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 connectSecure: true, | 519 connectSecure: true, |
519 handshakeBeforeSecure: false, | 520 handshakeBeforeSecure: false, |
520 postponeSecure: false, | 521 postponeSecure: false, |
521 dropReads: true); | 522 dropReads: true); |
522 testSimpleReadWrite(listenSecure: false, | 523 testSimpleReadWrite(listenSecure: false, |
523 connectSecure: false, | 524 connectSecure: false, |
524 handshakeBeforeSecure: true, | 525 handshakeBeforeSecure: true, |
525 postponeSecure: true, | 526 postponeSecure: true, |
526 dropReads: true); | 527 dropReads: true); |
527 } | 528 } |
OLD | NEW |