| 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"; | 10 import "dart:async"; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 Expect.isTrue(error is SocketException); | 46 Expect.isTrue(error is SocketException); |
| 47 asyncEnd(); | 47 asyncEnd(); |
| 48 }); | 48 }); |
| 49 | 49 |
| 50 // Bind to a port already in use. | 50 // Bind to a port already in use. |
| 51 asyncStart(); | 51 asyncStart(); |
| 52 RawSecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((s) { | 52 RawSecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((s) { |
| 53 RawSecureServerSocket.bind(HOST_NAME, | 53 RawSecureServerSocket.bind(HOST_NAME, |
| 54 s.port, | 54 s.port, |
| 55 CERTIFICATE).then((t) { | 55 CERTIFICATE).then((t) { |
| 56 Expect.fail("Multiple listens on same port"); | |
| 57 s.close(); | 56 s.close(); |
| 58 t.close(); | 57 t.close(); |
| 59 port.toSendPort().send(1); | 58 Expect.fail("Multiple listens on same port"); |
| 60 }) | 59 }) |
| 61 .catchError((error) { | 60 .catchError((error) { |
| 62 Expect.isTrue(error is SocketException); | 61 Expect.isTrue(error is SocketException); |
| 63 s.close(); | 62 s.close(); |
| 64 asyncEnd(); | 63 asyncEnd(); |
| 65 }); | 64 }); |
| 66 }); | 65 }); |
| 67 } | 66 } |
| 68 | 67 |
| 69 void testSimpleConnect(String certificate) { | 68 void testSimpleConnect(String certificate) { |
| 70 asyncStart(); | 69 asyncStart(); |
| 71 RawSecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) { | 70 RawSecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) { |
| 72 var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port); | 71 var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port); |
| 73 server.listen((serverEnd) { | 72 server.listen((serverEnd) { |
| 74 clientEndFuture.then((clientEnd) { | 73 clientEndFuture.then((clientEnd) { |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 connectSecure: true, | 520 connectSecure: true, |
| 522 handshakeBeforeSecure: false, | 521 handshakeBeforeSecure: false, |
| 523 postponeSecure: false, | 522 postponeSecure: false, |
| 524 dropReads: true); | 523 dropReads: true); |
| 525 testSimpleReadWrite(listenSecure: false, | 524 testSimpleReadWrite(listenSecure: false, |
| 526 connectSecure: false, | 525 connectSecure: false, |
| 527 handshakeBeforeSecure: true, | 526 handshakeBeforeSecure: true, |
| 528 postponeSecure: true, | 527 postponeSecure: true, |
| 529 dropReads: true); | 528 dropReads: true); |
| 530 } | 529 } |
| OLD | NEW |