2023-06-18 18:59:54 +00:00
|
|
|
import 'package:moxxmpp_socket_tcp/moxxmpp_socket_tcp.dart';
|
|
|
|
|
|
|
|
/// A simple socket for examples that allows injection of SRV records (since
|
|
|
|
/// we cannot use moxdns here).
|
|
|
|
class ExampleTCPSocketWrapper extends TCPSocketWrapper {
|
2023-10-04 20:15:24 +00:00
|
|
|
ExampleTCPSocketWrapper(this.srvRecord, bool logData) : super(logData);
|
2023-06-18 18:59:54 +00:00
|
|
|
|
|
|
|
/// A potential SRV record to inject for testing.
|
|
|
|
final MoxSrvRecord? srvRecord;
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool onBadCertificate(dynamic certificate, String domain) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<List<MoxSrvRecord>> srvQuery(String domain, bool dnssec) async {
|
|
|
|
return [
|
|
|
|
if (srvRecord != null) srvRecord!,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|