initialize method
Initialize connection.
- Handshake
- Authenticate
- Handle command (connect/associate)
Implementation
Future<void> initialize() async {
try {
if (!await handshake()) {
await reject(CommandReplyCode.connectionDenied);
type = SocksConnectionType.none;
return;
}
final response = await _handleCommand();
if (response != null) {
await reject(response);
type = SocksConnectionType.none;
return;
}
} catch (e) {
return;
} finally {
await data.cancel();
done.ignore();
}
}