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

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 Android stubs for TlsSocket implementation. 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
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 // TODO(3593): Use a Dart HTTPS server for this test using TLS server sockets.
15 var tls = new TlsSocket("www.google.dk", 443);
16 String message = '';
17 tls.onConnect = () {
18 var get_list =
19 "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n".charCodes();
20 tls.writeList(get_list, 0, 20);
21 tls.writeList(get_list, 20, get_list.length - 20);
22 };
23 tls.onData = () {
24 var buffer = new List(2000);
25 int len = tls.readList(buffer, 0, 2000);
26 var received = new String.fromCharCodes(buffer.getRange(0, len));
27 message = '$message$received';
28 };
29 tls.onClosed = () {
30 Expect.isTrue(message.contains('</script></body></html>'));
31 };
32 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698