use of org.jivesoftware.smackx.dox.DnsOverXmppManager in project Smack by igniterealtime.
the class DoX method runDoxResolver.
public static XMPPTCPConnection runDoxResolver(String jid, String password) throws XMPPException, SmackException, IOException, InterruptedException {
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder().setXmppAddressAndPassword(jid, password).setResource("dns").setDebuggerFactory(ConsoleDebugger.Factory.INSTANCE).build();
XMPPTCPConnection connection = new XMPPTCPConnection(config);
connection.connect().login();
DnsOverXmppManager dox = DnsOverXmppManager.getInstanceFor(connection);
dox.setDnsOverXmppResolver(DnsOverXmppMiniDnsResolver.INSTANCE);
dox.enable();
return connection;
}
use of org.jivesoftware.smackx.dox.DnsOverXmppManager in project Smack by igniterealtime.
the class DoX method main.
public static void main(String[] args) throws XMPPException, SmackException, IOException, InterruptedException {
SmackConfiguration.DEBUG = true;
XMPPTCPConnection connection = new XMPPTCPConnection(args[0], args[1]);
connection.setReplyTimeout(60000);
connection.connect().login();
DnsOverXmppManager dox = DnsOverXmppManager.getInstanceFor(connection);
Jid target = JidCreate.from("dns@moparisthebest.com/listener");
Question question = new Question("geekplace.eu", Record.TYPE.A);
DnsMessage response = dox.query(target, question);
// CHECKSTYLE:OFF
System.out.println(response);
// CHECKSTYLE:ON
connection.disconnect();
}
Aggregations