blob: 4949c5d33a4d3d4ce13c7fc1d35f0b1dd3557da8 [file] [log] [blame]
// Copyright (c) 2018, 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.
/// @assertion int port
/// Returns the port used by this socket.
///
/// @description Checks that port property returns the port used by this socket
/// and different sockets have different ports.
/// @author ngl@unipro.ru
import "dart:io";
import "../../../Utils/expect.dart";
check(InternetAddress address) {
asyncStart();
SecurityContext sc = new SecurityContext(withTrustedRoots: true);
RawSecureServerSocket.bind(address, 0, sc).then((socket1) {
RawSecureServerSocket.bind(address, 0, sc).then((socket2) {
Expect.notEquals(socket1.port, socket2.port);
socket2.close();
socket1.close();
asyncEnd();
});
});
}
main() {
check(InternetAddress.anyIPv4);
check(InternetAddress.anyIPv6);
check(InternetAddress.loopbackIPv4);
check(InternetAddress.loopbackIPv6);
}