| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // This test tests TLS session resume, by making multiple client connections | 5 // This test tests TLS session resume, by making multiple client connections |
| 6 // on the same port to the same server, with a delay of 200 ms between them. | 6 // on the same port to the same server, with a delay of 200 ms between them. |
| 7 // The unmodified secure_server_test creates all sessions simultaneously, | 7 // The unmodified secure_server_test creates all sessions simultaneously, |
| 8 // which means that no handshake completes and caches its keys in the session | 8 // which means that no handshake completes and caches its keys in the session |
| 9 // cache in time for other connections to use it. | 9 // cache in time for other connections to use it. |
| 10 // | 10 // |
| 11 // Session resume is currently disabled - see issue | 11 // Session resume is currently disabled - see issue |
| 12 // https://code.google.com/p/dart/issues/detail?id=7230 | 12 // https://code.google.com/p/dart/issues/detail?id=7230 |
| 13 | 13 |
| 14 import "dart:async"; | 14 import "dart:async"; |
| 15 import "dart:io"; | 15 import "dart:io"; |
| 16 import "dart:isolate"; | 16 import "dart:isolate"; |
| 17 | 17 |
| 18 const SERVER_ADDRESS = "127.0.0.1"; | 18 const SERVER_ADDRESS = "127.0.0.1"; |
| 19 const HOST_NAME = "localhost"; | 19 const HOST_NAME = "localhost"; |
| 20 | 20 |
| 21 void WriteAndClose(Socket socket, String message) { | 21 void WriteAndClose(Socket socket, String message) { |
| 22 var data = message.charCodes; | 22 var data = message.codeUnits; |
| 23 int written = 0; | 23 int written = 0; |
| 24 void write() { | 24 void write() { |
| 25 written += socket.writeList(data, written, data.length - written); | 25 written += socket.writeList(data, written, data.length - written); |
| 26 if (written < data.length) { | 26 if (written < data.length) { |
| 27 socket.onWrite = write; | 27 socket.onWrite = write; |
| 28 } else { | 28 } else { |
| 29 socket.close(true); | 29 socket.close(true); |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 write(); | 32 write(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 Duration delay = const Duration(milliseconds: 0); | 126 Duration delay = const Duration(milliseconds: 0); |
| 127 Duration delay_between_connections = const Duration(milliseconds: 300); | 127 Duration delay_between_connections = const Duration(milliseconds: 300); |
| 128 | 128 |
| 129 for (var x in CLIENT_NAMES) { | 129 for (var x in CLIENT_NAMES) { |
| 130 new Timer(delay, () { | 130 new Timer(delay, () { |
| 131 new SecureTestClient(port, x); | 131 new SecureTestClient(port, x); |
| 132 }); | 132 }); |
| 133 delay += delay_between_connections; | 133 delay += delay_between_connections; |
| 134 } | 134 } |
| 135 } | 135 } |
| OLD | NEW |