title: Why JavaMail connection timeout is too long
body: <p>In my application I connect to server to  authenticate users. This is code:</p>
  
  <pre><code>try {
          Properties prop = new Properties();
          prop.put("mail.smtp.starttls.enable","true");
          prop.put("mail.smtp.auth", "true");
          prop.put("mail.smtp.connectiontimeout", 1000);
  
  
          Session session = Session.getInstance(prop, null);
          Transport transport = session.getTransport("smtp");
          transport.connect("mion.elka.pw.edu.pl", 587, registerLog, registerPass);
          transport.close();
          return true;
      } catch (NoSuchProviderException ex) {
          Logger.getLogger(RegisterController.class.getName()).log(Level.SEVERE, null, ex);
          return false;
      } catch(AuthenticationFailedException ex) {
          Logger.getLogger(RegisterController.class.getName()).log(Level.SEVERE, null, ex);
          return false;
      } catch (MessagingException ex) {
          Logger.getLogger(RegisterController.class.getName()).log(Level.SEVERE, null, ex);
          return false;
      }
  </code></pre>
  
  <p>I set connection timeout to 1000 ms = 1s but it's ignore. When i debug and set wrong username and password i catch </p>
  
  <pre><code>javax.mail.MessagingException: java.net.SocketTimeoutException: Read timed out
  </code></pre>
  
  <p>not after 1000 ms, but after 5000*60 ms = 5 min</p>
  
  <p>What is wrong ? How can i reduce timeoute ?</p>