Greetings.
I am evaluating the Smack library for a XMPP-based project, and I am trying to log from my prototype into a local XMPP server. I had already tried prototypes in node.js and Python and didn’t meet any problem to reach the server with the localhost address. Here is my Smack-based implementation (only the relevant snippet):
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword(user, password)
.setXmppDomain(xmppDomain)
.setHost(hostname)
.setSecurityMode(securityMode)
.setPort(Integer.parseInt(portArg)
.build();
AbstractXMPPConnection connection = new XMPPTCPConnection(config);
if (connection == null) {
System.err.println("Failed to instantiate a connection");
System.exit(1);
}
connection.connect();
System.out.println("Connected to " + hostname);
connection.login();
System.out.println("Logged as " + user);
When testing this code, I get the following error:
$ java org.mydomain.hellosmack.HelloSmack localhost
Smack version 4.3.4 (4.3.4-4.3 2019-05-27)
user: me@localhost
password: <hidden>
Exception in thread "main" org.jivesoftware.smack.SmackException$ConnectionException: *The following addresses failed*
at org.jivesoftware.smack.SmackException$ConnectionException.from(SmackException.java:292)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPConnection.java:668)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:971)
at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:435)
at org.mydomain.hellosmack.HelloSmack.main(HelloSmack.java:66)
Am I missing anything (either in the code or in the configuration)? While it is in my plans, I would like to avoid setting up a heavy environment (e.g. a domain name, a name server, a fixed IP address and a remote XMPP server) at this stage of the project, just for a local evaluation. Is it possible with Smack? Thanks.