startConnect 静态方法
- dynamic host,
- int port,
- {SecurityContext? context,
- bool onBadCertificate(
- X509Certificate certificate
- void keyLog(
- String line
- List<
String> ? supportedProtocols}
override
类似于 connect,但它返回一个 Future,该 Future 在不再需要 SecureSocket 时可通过 ConnectionTask
取消。
实现
static Future<ConnectionTask<SecureSocket>> startConnect(host, int port,
{SecurityContext? context,
bool onBadCertificate(X509Certificate certificate)?,
void keyLog(String line)?,
List<String>? supportedProtocols}) {
return RawSecureSocket.startConnect(host, port,
context: context,
onBadCertificate: onBadCertificate,
keyLog: keyLog,
supportedProtocols: supportedProtocols)
.then((rawState) {
Future<SecureSocket> socket =
rawState.socket.then((rawSocket) => new SecureSocket._(rawSocket));
return new ConnectionTask<SecureSocket>._(socket, rawState._onCancel);
});
}