Search in sources :

Example 1 with DnsOverXmppManager

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;
}
Also used : DnsOverXmppManager(org.jivesoftware.smackx.dox.DnsOverXmppManager) XMPPTCPConnection(org.jivesoftware.smack.tcp.XMPPTCPConnection) XMPPTCPConnectionConfiguration(org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration)

Example 2 with DnsOverXmppManager

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();
}
Also used : DnsOverXmppManager(org.jivesoftware.smackx.dox.DnsOverXmppManager) XMPPTCPConnection(org.jivesoftware.smack.tcp.XMPPTCPConnection) Jid(org.jxmpp.jid.Jid) Question(org.minidns.dnsmessage.Question) DnsMessage(org.minidns.dnsmessage.DnsMessage)

Aggregations

XMPPTCPConnection (org.jivesoftware.smack.tcp.XMPPTCPConnection)2 DnsOverXmppManager (org.jivesoftware.smackx.dox.DnsOverXmppManager)2 XMPPTCPConnectionConfiguration (org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration)1 Jid (org.jxmpp.jid.Jid)1 DnsMessage (org.minidns.dnsmessage.DnsMessage)1 Question (org.minidns.dnsmessage.Question)1