title: Exception occurred on login method of XMPPConnection in smack
body: <p>I wrote the following code:</p>
  
  <pre><code>ConnectionConfiguration connConfig = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com");
  XMPPConnection connection = new XMPPConnection(connConfig);
  connection.connect();
  System.in.read();
  connection.login("xxx@gmail.com", "***"); //Exception occurs here!
  </code></pre>
  
  <p>The exception is </p>
  
  <pre><code>java.net.SocketException: Connection reset
  at java.net.SocketInputStream.read(SocketInputStream.java:185) 
  at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:282)
  at sun.nio.cs.StreamDecoder.implRead (StreamDecoder.java:324)
  at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:176)
  at java.io.InputStreamReader.read(InputStreamReader.java:184)
  at java.io.BufferedReader.fill(BufferedReader.java:153)
  at java.io.BufferedReader.read1(BufferedReader.java:204)
  at java.io.BufferedReader.read(BufferedReader.java:278)
  at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:2992)
  at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
  at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1144)
  at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
  at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:325)
  at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)
  at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)Exception in thread "main" No response from the server.:
  at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication.java:73)
  at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:212)
  at org.jivesoftware.smack.Connection.login(Connection.java:348)
  </code></pre>
  
  <p>Also sometimes I get this exception:</p>
  
  <pre><code>Exception in thread "main" Connection failed. No response from server.:at org.jivesoftware.smack.PacketReader.startup(PacketReader.java:119)
  at org.jivesoftware.smack.XMPPConnection.initConnection(XMPPConnection.java:568)
  at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:527)
  at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:953)
  </code></pre>
  
  <p>Can anybody help me? I google it and some people said that it will be OK if you put some delay using <code>Thread.sleep(10000);</code> between connect and login. But it doesn't work!</p>