Index: tests/standalone/io/socket_info_test.dart |
diff --git a/tests/standalone/io/socket_info_test.dart b/tests/standalone/io/socket_info_test.dart |
index e35eab6b8242ce6c47ddb721bb5b70bb26e30000..f3b675f8e0288d8a771f8e815fb9ad8436e9c971 100644 |
--- a/tests/standalone/io/socket_info_test.dart |
+++ b/tests/standalone/io/socket_info_test.dart |
@@ -1,23 +1,24 @@ |
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
+// Copyright (c) 2013, 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. |
import "dart:io"; |
void testHostAndPort() { |
- ServerSocket server = new ServerSocket("127.0.0.1", 0, 5); |
+ ServerSocket.bind().then((server) { |
- Socket clientSocket = new Socket("127.0.0.1", server.port); |
+ Socket.connect("127.0.0.1", server.port).then((clientSocket) { |
+ server.listen((socket) { |
+ Expect.equals(socket.port, server.port); |
+ Expect.equals(clientSocket.port, socket.remotePort); |
+ Expect.equals(clientSocket.remotePort, socket.port); |
+ Expect.equals(socket.remoteHost, "127.0.0.1"); |
+ Expect.equals(clientSocket.remoteHost, "127.0.0.1"); |
- server.onConnection = (Socket socket) { |
- Expect.equals(socket.port, server.port); |
- Expect.equals(clientSocket.port, socket.remotePort); |
- Expect.equals(clientSocket.remotePort, socket.port); |
- Expect.equals(socket.remoteHost, "127.0.0.1"); |
- Expect.equals(clientSocket.remoteHost, "127.0.0.1"); |
- |
- server.close(); |
- }; |
+ server.close(); |
+ }); |
+ }); |
+ }); |
} |
void main() { |