This method seem to be the place where the time (15s) wait is coming from. It written that this is a rare thing, but in my case it’'s traps almost alwasy in this “rare” case. It calls the “connectionIDLock.wait(waitTime * 3);” stuff where the waitTime is 5s. it has to do with TLS but I do plain text auth. and plain text messaging (sever + client are on the same server).How can I disable TLS? Thanks.
from: PacketReader.java in the smack.jar
/**
-
Starts the packet reader thread and returns once a connection to the server
-
has been established. A connection will be attempted for a maximum of five
-
seconds. An XMPPException will be thrown if the connection fails.
*/
public void startup() throws XMPPException {
readerThread.start();
listenerThread.start();
// Wait for stream tag before returing. We’'ll wait a couple of seconds before
// giving up and throwing an error.
try {
synchronized(connectionIDLock) {
if (connectionID == null) {
// A waiting thread may be woken up before the wait time or a notify
// (although this is a rare thing). Therefore, we continue waiting
// until either a connectionID has been set (and hence a notify was
// made) or the total wait time has elapsed.
long waitTime = SmackConfiguration.getPacketReplyTimeout();
long start = System.currentTimeMillis();
while (connectionID == null && !done) {
if (waitTime <= 0) {
break;
}
// Wait 3 times the standard time since TLS may take a while
connectionIDLock.wait(waitTime * 3);
long now = System.currentTimeMillis();
waitTime -= now - start;
start = now;
}
}
}
}
catch (InterruptedException ie) {
// Ignore.
}
if (connectionID == null) {
throw new XMPPException(“Connection failed. No response from server.”);
}
else {
connection.connectionID = connectionID;
}
}