blob: ba2233f6ff50b9b7c1668597664d4cb35f3273df [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.
// @dart = 2.9
/// @assertion InternetAddress address
/// Returns the address used by this socket.
///
/// @description Checks that returned address property is equal to a value of
/// address parameter used in bind method.
/// @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((server) {
InternetAddress adr = server.address;
Expect.equals(address, adr);
server.close();
asyncEnd();
});
}
main() {
check(InternetAddress.anyIPv4);
check(InternetAddress.anyIPv6);
check(InternetAddress.loopbackIPv4);
check(InternetAddress.loopbackIPv6);
}