I'm trying to connect to openfire/ejabberd(I have both of them configured and tested for connection with strophe.js) on localhost using smack. This is what I've tried:
Log.d(TAG, "Connecting to server " + mServiceName);
XMPPTCPConnectionConfiguration.Builder config = XMPPTCPConnectionConfiguration.builder();
config.setUsernameAndPassword("test_user1@home", "password");
config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
config.setServiceName("home");
config.setHost("127.0.0.1");
config.setPort(5222);
config.setCompressionEnabled(true);
config.setDebuggerEnabled(true);
final XMPPTCPConnection xmpptcpConnection = new XMPPTCPConnection(config.build());
SASLAuthentication.blacklistSASLMechanism("DIGEST-MD5");
mConnection = new XMPPTCPConnection(config.build());
mConnection.setPacketReplyTimeout(10000);
mConnection.addConnectionListener(this);
mConnection.connect();
mConnection.login();
but I get back:
org.jivesoftware.smack.SmackException$ConnectionException: The following addresses failed: '127.0.0.1:5222' failed because java.net.ConnectException: failed to connect to /127.0.0.1 (port 5222) after 30000ms: isConnected failed: ECONNREFUSED (Connection refused)
I'm using my phone to connect. I assume that this is happening because it is not registered on the internet. I've purchased a domain and created a subdomain, but I have no idea on how to register my openfire/ejabberd server with that.
If anything is as it should with the builder configuration could anybody give me some intructions on how to register it?
Edit: To register openfire on a public account I have to enable ssh and do some configuration(I would rather not). Isn't there any way to test my android app on my local account?