| Index: tests/standalone/io/tls_server_test.dart
|
| diff --git a/tests/standalone/io/tls_server_test.dart b/tests/standalone/io/tls_server_test.dart
|
| index 165c1ef85e632d1996b0d139800cb306a2bc244b..9d3c7cf6e4a0649816d755da28a75cc7029e4280 100644
|
| --- a/tests/standalone/io/tls_server_test.dart
|
| +++ b/tests/standalone/io/tls_server_test.dart
|
| @@ -12,13 +12,16 @@ class TlsTestServer {
|
| connection.onConnect = () {
|
| numConnections++;
|
| };
|
| + String received = "";
|
| connection.onData = () {
|
| - var data = connection.read();
|
| - var received = new String.fromCharCodes(data);
|
| + received = received.concat(new String.fromCharCodes(connection.read()));
|
| + };
|
| + connection.onClosed = () {
|
| Expect.isTrue(received.contains("Hello from client "));
|
| String name = received.substring(received.indexOf("client ") + 7);
|
| var reply_bytes = "Welcome, client $name".charCodes;
|
| connection.writeList(reply_bytes, 0, reply_bytes.length);
|
| + connection.close(true);
|
| };
|
| }
|
|
|
| @@ -46,7 +49,10 @@ class TlsTestClient {
|
| TlsTestClient(int this.port, String this.name) {
|
| socket = new TlsSocket(HOST_NAME, port);
|
| socket.onConnect = this.onConnect;
|
| - socket.onData = this.onData;
|
| + socket.onData = () {
|
| + reply = reply.concat(new String.fromCharCodes(socket.read()));
|
| + };
|
| + socket.onClosed = done;
|
| reply = "";
|
| }
|
|
|
| @@ -55,20 +61,11 @@ class TlsTestClient {
|
| var request_bytes =
|
| "Hello from client $name".charCodes;
|
| socket.writeList(request_bytes, 0, request_bytes.length);
|
| - }
|
| -
|
| - void onData() {
|
| - var data = socket.read();
|
| - var received = new String.fromCharCodes(data);
|
| - reply = reply.concat(received);
|
| - if (reply.contains("Welcome") && reply.contains(name)) {
|
| - done();
|
| - }
|
| + socket.close(true);
|
| }
|
|
|
| void done() {
|
| Expect.equals("Welcome, client $name", reply);
|
| - socket.close(true);
|
| numReplies++;
|
| if (numReplies == CLIENT_NAMES.length) {
|
| Expect.equals(numRequests, numReplies);
|
|
|