close method
Closes the connection to the Tor proxy.
Returns: A Future that resolves to void.
Implementation
Future<void> close() async {
// Ensure all data is sent before closing.
try {
if (sslEnabled) {
await _secureSocksSocket.flush();
}
await _socksSocket.flush();
} finally {
await _subscription?.cancel();
await _socksSocket.close();
_responseController.close();
if (sslEnabled) {
_secureResponseController.close();
}
}
}