次の例外:
SocketIOException: Unexpected handshake error in client (OS Error: errno = -12268)
#0 _SecureFilterImpl.handshake (dart:io-patch:849:8)
#1 _SecureSocket._secureHandshake (dart:io:7382:28)
#2 _SecureSocket._secureConnectHandler._secureConnectHandler (dart:io:7294:21)
#3 _Socket._updateOutHandler.firstWriteHandler (dart:io-patch:773:64)
#4 _SocketBase._multiplex (dart:io-patch:408:26)
#5 _SocketBase._sendToEventHandler.<anonymous closure> (dart:io-patch:509:20)
#6 _ReceivePortImpl._handleMessage (dart:isolate-patch:37:92)
次のコードの結果:
String url = "https://www.google.com";
HttpClient client = new HttpClient();
HttpClientConnection conn = client.getUrl(new Uri(url));
conn.onResponse = (HttpClientResponse resp) {
print ('content length ${resp.contentLength}');
print ('status code ${resp.statusCode}');
InputStream input = resp.inputStream;
input.onData = () {
print(codepointsToString(input.read()));
};
input.onClosed = () {
print('closed!');
client.shutdown();
};
};
URLを「https」ではなく「http」に置き換えると、期待どおりに機能することに注意してください。