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 "dart:async"; | 11 import "dart:async"; |
12 import "dart:io"; | 12 import "dart:io"; |
13 import "dart:isolate"; | 13 import "dart:isolate"; |
14 | 14 |
15 const SERVER_ADDRESS = "127.0.0.1"; | |
16 const HOST_NAME = "localhost"; | 15 const HOST_NAME = "localhost"; |
17 const CERTIFICATE = "localhost_cert"; | 16 const CERTIFICATE = "localhost_cert"; |
18 | 17 |
19 // This test creates a server and a client connects. After connecting | 18 // This test creates a server and a client connects. After connecting |
20 // and an optional initial handshake the connection is secured by | 19 // and an optional initial handshake the connection is secured by |
21 // upgrading to a secure connection The client then writes and the | 20 // upgrading to a secure connection The client then writes and the |
22 // server echos. When the server has finished its echo it | 21 // server echos. When the server has finished its echo it |
23 // half-closes. When the client gets the close event is closes fully. | 22 // half-closes. When the client gets the close event is closes fully. |
24 // | 23 // |
25 // The test can be run in different configurations based on | 24 // The test can be run in different configurations based on |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 }); | 187 }); |
189 }); | 188 }); |
190 } | 189 } |
191 }); | 190 }); |
192 | 191 |
193 connectClient(server.port).then(runClient).then((socket) { | 192 connectClient(server.port).then(runClient).then((socket) { |
194 port.close(); | 193 port.close(); |
195 }); | 194 }); |
196 } | 195 } |
197 | 196 |
198 ServerSocket.bind(SERVER_ADDRESS, 0, 5).then(serverReady); | 197 ServerSocket.bind(HOST_NAME, 0, 5).then(serverReady); |
199 } | 198 } |
200 | 199 |
201 main() { | 200 main() { |
202 Path scriptDir = new Path(new Options().script).directoryPath; | 201 Path scriptDir = new Path(new Options().script).directoryPath; |
203 Path certificateDatabase = scriptDir.append('pkcert'); | 202 Path certificateDatabase = scriptDir.append('pkcert'); |
204 SecureSocket.initialize(database: certificateDatabase.toNativePath(), | 203 SecureSocket.initialize(database: certificateDatabase.toNativePath(), |
205 password: 'dartdart', | 204 password: 'dartdart', |
206 useBuiltinRoots: false); | 205 useBuiltinRoots: false); |
207 test(false); | 206 test(false); |
208 test(true); | 207 test(true); |
209 test(true, true); | 208 test(true, true); |
210 } | 209 } |
OLD | NEW |