Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: tests/standalone/io/tls_socket_test.dart

Issue 10704159: Start adding TLS (SSL) sockets to dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add proper event handling during handshake phase of connection. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« runtime/bin/tls_socket_linux.cc ('K') | « runtime/include/dart_api.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 //
5 // VMOptions=
6 // VMOptions=--short_socket_read
7 // VMOptions=--short_socket_write
8 // VMOptions=--short_socket_read --short_socket_write
9
10 #import("dart:isolate");
11 #import("dart:io");
12
13 void main() {
14 var tls = new TlsSocket("www.google.dk", 443);
Anders Johnsen 2012/07/27 15:58:49 I'm unsure to if this is good practice or not - ma
Bill Hesse 2012/08/08 17:00:05 Done.
15 String message = '';
16 tls.onConnect = () {
17 var get_list =
18 "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n".charCodes();
19 // tls.writeList(get_list, 0, get_list.length);
20 var push = new Timer(5000, (ignore) {
21 tls.writeList(get_list, 0, 20);
22 tls.writeList(get_list, 20, get_list.length - 20);
23 });
24
25 };
26 tls.onData = () {
27 var buffer = new List(2000);
28 int len = tls.readList(buffer, 0, 2000);
29 print('length: $len');
30 var received = new String.fromCharCodes(buffer.getRange(0, len));
31 message = '$message$received';
32 print(received);
Anders Johnsen 2012/07/27 15:58:49 Print and out-commented code.
33 // if (isCompleteChunkedTransfer(message)) {
34 // tls.close();
35 //}
36 };
37 tls.onClosed = () {
38 print('tls close event fired');
39 // tls.close();
Anders Johnsen 2012/07/27 15:58:49 Ditto here.
40 print(message);
41 print('\nREACHED END OF TEST');
42 };
43 }
OLDNEW
« runtime/bin/tls_socket_linux.cc ('K') | « runtime/include/dart_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698