List of usage examples for javax.mail Transport addConnectionListener
public void addConnectionListener(ConnectionListener l)
From source file:com.googlecode.gmail4j.javamail.ImapGmailConnection.java
/** * Gets Gmail {@link Transport}//from www . j a v a 2 s . com * * @return Configured and ready for use Transport */ public Transport getTransport() { try { final Transport transport = getSession().getTransport(); transport.addConnectionListener(new ImapConnectionHandler( new ConnectionInfo(loginCredentials.getUsername(), gmailSmtpHost, gmailSmtpPort))); transport.connect(loginCredentials.getUsername(), new String(loginCredentials.getPasword())); return transport; } catch (final Exception e) { throw new GmailException("ImapGmailClient requires ImapGmailConnection!"); } }