1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

Move host/port from ConnectionConfiguration to XMPPConnection

There semantic is that they now report the host used to establish the
connection. Therefore BOSHConfiguration needs to hostAddresses for
getURI().
This commit is contained in:
Florian Schmaus 2014-03-18 09:27:45 +01:00
parent 81d49d2f60
commit 44a5408bc0
4 changed files with 22 additions and 35 deletions

View file

@ -22,6 +22,7 @@ import java.net.URISyntaxException;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.proxy.ProxyInfo;
import org.jivesoftware.smack.util.dns.HostAddress;
/**
* Configuration to use while establishing the connection to the XMPP server via
@ -112,6 +113,9 @@ public class BOSHConfiguration extends ConnectionConfiguration {
if (file.charAt(0) != '/') {
file = '/' + file;
}
return new URI((ssl ? "https://" : "http://") + getHost() + ":" + getPort() + file);
HostAddress hostAddress = hostAddresses.get(0);
String host = hostAddress.getFQDN();
int port = hostAddress.getPort();
return new URI((ssl ? "https://" : "http://") + host + ":" + port + file);
}
}