title: How to connect to security disabled ejabberd using smack-android?
body: <p>I'm having problems connecting to my ejabberd 2.1.11 server using smack 4.1.0-beta2. I thought it had something to do with SSL certificates and not wanting to deal with that stuff I'm just running ejabberd without starting TLS. I know that's working bc I'm able to connect to ejabberd using psi without warning me about some self-signed certificate.</p>
  
  <p>Anyways, I'm using the following ConnectionConfiguration's</p>
  
  <pre><code>XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();
  configBuilder.setUsernameAndPassword("username", "password");
  configBuilder.setServiceName("myapp.ddns.net");
  configBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
  configBuilder.setCompressionEnabled(false);
  AbstractXMPPConnection xmppConnection = new XMPPTCPConnection(configBuilder.build());
  </code></pre>
  
  <p>So when I try xmppConnection.connect(), I get the following exceptions</p>
  
  <pre><code>02-05 01:01:42.965  17047-17047/net.ddns.myapp W/DNSUtil﹕ Exception while resovling SRV records for myapp.ddns.net. Consider adding '_xmpp-(server|client)._tcp' DNS SRV Records
      android.os.NetworkOnMainThreadException
              at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
              at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:175)
              at libcore.io.IoBridge.sendto(IoBridge.java:463)
              at java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java:182)
              at java.net.DatagramSocket.send(DatagramSocket.java:287)
              at de.measite.minidns.Client.query(Client.java:199)
              at de.measite.minidns.Client.query(Client.java:174)
              at de.measite.minidns.Client.query(Client.java:236)
              at de.measite.minidns.Client.query(Client.java:149)
              at org.jivesoftware.smack.util.dns.minidns.MiniDnsResolver.lookupSRVRecords(MiniDnsResolver.java:79)
              at org.jivesoftware.smack.util.DNSUtil.resolveDomain(DNSUtil.java:162)
              at org.jivesoftware.smack.util.DNSUtil.resolveXMPPDomain(DNSUtil.java:119)
              at org.jivesoftware.smack.AbstractXMPPConnection.populateHostAddresses(AbstractXMPPConnection.java:551)
              at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPConnection.java:506)
              at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:810)
              at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:355)
              at net.ddns.myapp.MainActivity.onCreate(MainActivity.java:61)
              at android.app.Activity.performCreate(Activity.java:4465)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
              at android.app.ActivityThread.access$600(ActivityThread.java:127)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
              at android.os.Handler.dispatchMessage(Handler.java:99)
              at android.os.Looper.loop(Looper.java:137)
              at android.app.ActivityThread.main(ActivityThread.java:4507)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:511)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
              at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>and also</p>
  
  <pre><code>02-05 01:01:42.980  17047-17047/net.ddns.myapp E/MyApp﹕ Error while establishing XMPPConnection
      org.jivesoftware.smack.SmackException$ConnectionException: The following addresses failed: myapp.ddns.net:5222 Exception: null
              at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPConnection.java:551)
              at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:810)
              at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:355)
              at net.ddns.myapp.MainActivity.onCreate(MainActivity.java:61)
              at android.app.Activity.performCreate(Activity.java:4465)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
              at android.app.ActivityThread.access$600(ActivityThread.java:127)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
              at android.os.Handler.dispatchMessage(Handler.java:99)
              at android.os.Looper.loop(Looper.java:137)
              at android.app.ActivityThread.main(ActivityThread.java:4507)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:511)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
              at dalvik.system.NativeStart.main(Native Method)
  </code></pre>