Chromium Code Reviews| Index: tests/standalone/io/tls_socket_test.dart |
| diff --git a/tests/standalone/io/tls_socket_test.dart b/tests/standalone/io/tls_socket_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..eb4839c9cc535680e9a5fb6510ad5709ac1e5381 |
| --- /dev/null |
| +++ b/tests/standalone/io/tls_socket_test.dart |
| @@ -0,0 +1,43 @@ |
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| +// |
| +// VMOptions= |
| +// VMOptions=--short_socket_read |
| +// VMOptions=--short_socket_write |
| +// VMOptions=--short_socket_read --short_socket_write |
| + |
| +#import("dart:isolate"); |
| +#import("dart:io"); |
| + |
| +void main() { |
| + var tls = new TlsSocket("www.google.dk", 443); |
| + String message = ''; |
| + tls.onConnect = () { |
| + var get_list = |
| + "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n".charCodes(); |
|
Søren Gjesse
2012/07/31 09:07:15
Perhaps use HTTP/1.1 for the test.
|
| + // tls.writeList(get_list, 0, get_list.length); |
| + var push = new Timer(5000, (ignore) { |
| + tls.writeList(get_list, 0, 20); |
| + tls.writeList(get_list, 20, get_list.length - 20); |
| + }); |
| + |
| + }; |
| + tls.onData = () { |
| + var buffer = new List(2000); |
| + int len = tls.readList(buffer, 0, 2000); |
| + print('length: $len'); |
| + var received = new String.fromCharCodes(buffer.getRange(0, len)); |
| + message = '$message$received'; |
| + print(received); |
| + // if (isCompleteChunkedTransfer(message)) { |
|
Mads Ager (google)
2012/07/31 10:16:01
Code in comment.
Bill Hesse
2012/08/08 17:00:05
Done.
|
| + // tls.close(); |
| + //} |
| + }; |
| + tls.onClosed = () { |
| + print('tls close event fired'); |
| + // tls.close(); |
|
Mads Ager (google)
2012/07/31 10:16:01
Code in comment.
Bill Hesse
2012/08/08 17:00:05
Done.
|
| + print(message); |
| + print('\nREACHED END OF TEST'); |
| + }; |
| +} |