Chromium Code Reviews| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 if (bytesWritten == data.length) { | 107 if (bytesWritten == data.length) { |
| 108 baseSocket.write(data, 0, 300); | 108 baseSocket.write(data, 0, 300); |
| 109 socket.shutdown(SocketDirection.SEND); | 109 socket.shutdown(SocketDirection.SEND); |
| 110 } | 110 } |
| 111 break; | 111 break; |
| 112 case RawSocketEvent.READ_CLOSED: | 112 case RawSocketEvent.READ_CLOSED: |
| 113 completer.complete(null); | 113 completer.complete(null); |
| 114 break; | 114 break; |
| 115 default: throw "Unexpected event $event"; | 115 default: throw "Unexpected event $event"; |
| 116 } | 116 } |
| 117 }, | |
| 118 onError: (e) { | |
| 119 Expect.isTrue(e is IOException); | |
|
Anders Johnsen
2013/07/04 09:42:32
IOException? Not any higher-level error?
| |
| 120 completer.complete(null); | |
| 117 }); | 121 }); |
| 118 return completer.future; | 122 return completer.future; |
| 119 } | 123 } |
| 120 | 124 |
| 121 | 125 |
| 122 Future<List> connectClient(int port) => | 126 Future<List> connectClient(int port) => |
| 123 RawSocket.connect(HOST_NAME, port) | 127 RawSocket.connect(HOST_NAME, port) |
| 124 .then((socket) => | 128 .then((socket) => |
| 125 (hostnameInConnect ? RawSecureSocket.secure(socket) | 129 (hostnameInConnect ? RawSecureSocket.secure(socket) |
| 126 : RawSecureSocket.secure(socket, host: HOST_NAME)) | 130 : RawSecureSocket.secure(socket, host: HOST_NAME)) |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 145 | 149 |
| 146 main() { | 150 main() { |
| 147 Path scriptDir = new Path(Platform.script).directoryPath; | 151 Path scriptDir = new Path(Platform.script).directoryPath; |
| 148 Path certificateDatabase = scriptDir.append('pkcert'); | 152 Path certificateDatabase = scriptDir.append('pkcert'); |
| 149 SecureSocket.initialize(database: certificateDatabase.toNativePath(), | 153 SecureSocket.initialize(database: certificateDatabase.toNativePath(), |
| 150 password: 'dartdart', | 154 password: 'dartdart', |
| 151 useBuiltinRoots: false); | 155 useBuiltinRoots: false); |
| 152 test(false); | 156 test(false); |
| 153 test(true); | 157 test(true); |
| 154 } | 158 } |
| OLD | NEW |