title: why could have connection timed out exception if the default timeout value is infinite?
body: <p>Use spring <code>JavaMailSender</code> to send email, sometimes there are below exception</p>
  
  <pre><code>org.springframework.mail.MailSendException: Mail server connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: mail.foo.com, 25; timeout -1;
  nested exception is:
  java.net.ConnectException: Connection timed out. Failed messages: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: mail.foo.com, 25; timeout -1;
    nested exception is:
  java.net.ConnectException: Connection timed out
  at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:432) ~[spring-context-support-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
  at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:345) ~[spring-context-support-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
  at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340) ~[spring-context-support-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
  </code></pre>
  
  <p>At first I thought maybe the default timeout is not long enough, and I could set a longer value to avoid the exception. e.g.</p>
  
  <pre><code>&lt;prop key="mail.smtp.timeout"&gt;10000&lt;/prop&gt;
  </code></pre>
  
  <p>but when I read the document I find the defalt timeout value is <code>infinite</code>
  <a href="https://i.stack.imgur.com/Vet26.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vet26.png" alt="enter image description here"></a></p>
  
  <p>please see: <a href="https://javamail.java.net/nonav/docs/api/com/sun/mail/smtp/package-summary.html" rel="nofollow noreferrer">https://javamail.java.net/nonav/docs/api/com/sun/mail/smtp/package-summary.html</a></p>
  
  <p>So if it is infinite it should be blocked forever, why could have <code>ConnectException</code>?</p>