diff options
author | Kevin Smith <git@kismith.co.uk> | 2012-02-23 16:37:07 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-02-23 16:37:07 (GMT) |
commit | c80110013f16d8aa4e6e9801e01ce9ccab1e6592 (patch) | |
tree | 7d02d379a82dda81fb2e3524b1631e7763baaf32 /src/com/isode/stroke/network/Connector.java | |
parent | f5e722a7f28f3407600e023700739ff3b9cc83c2 (diff) | |
download | stroke-c80110013f16d8aa4e6e9801e01ce9ccab1e6592.zip stroke-c80110013f16d8aa4e6e9801e01ce9ccab1e6592.tar.bz2 |
Allow non-standard ports on internal interface method
Diffstat (limited to 'src/com/isode/stroke/network/Connector.java')
-rw-r--r-- | src/com/isode/stroke/network/Connector.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/com/isode/stroke/network/Connector.java b/src/com/isode/stroke/network/Connector.java index 01fd114..fba0b95 100644 --- a/src/com/isode/stroke/network/Connector.java +++ b/src/com/isode/stroke/network/Connector.java @@ -19,8 +19,8 @@ import java.util.Collection; public class Connector { - public static Connector create(String hostname, DomainNameResolver resolver, ConnectionFactory connectionFactory, TimerFactory timerFactory) { - return new Connector(hostname, resolver, connectionFactory, timerFactory); + public static Connector create(String hostname, DomainNameResolver resolver, ConnectionFactory connectionFactory, TimerFactory timerFactory, int defaultPort) { + return new Connector(hostname, resolver, connectionFactory, timerFactory, defaultPort); } public void setTimeoutMilliseconds(int milliseconds) { @@ -56,11 +56,12 @@ public class Connector { public final Signal1<Connection> onConnectFinished = new Signal1<Connection>(); - private Connector(String hostname, DomainNameResolver resolver, ConnectionFactory connectionFactory, TimerFactory timerFactory) { + private Connector(String hostname, DomainNameResolver resolver, ConnectionFactory connectionFactory, TimerFactory timerFactory, int defaultPort) { this.hostname = hostname; this.resolver = resolver; this.connectionFactory = connectionFactory; this.timerFactory = timerFactory; + this.defaultPort = defaultPort; } private void handleServiceQueryResult(Collection<Result> result) { @@ -128,7 +129,7 @@ public class Connector { HostAddress address = addressQueryResults.get(0); addressQueryResults.remove(0); - int port = 5222; + int port = defaultPort; if (!serviceQueryResults.isEmpty()) { port = serviceQueryResults.get(0).port; } @@ -215,4 +216,5 @@ public class Connector { private boolean queriedAllServices = true; private Connection currentConnection; private SignalConnection currentConnectionConnectFinishedConnection; + private final int defaultPort; } |