Class ImapClient


public class ImapClient extends ClientConnection
  • Constructor Details

  • Method Details

    • imapStartTls

      public void imapStartTls() throws IOException

      Initiate a TLS handshake by issuing a STARTTLS command.

      Throws:
      IOException - if handshake fails or a timeout is reached
    • authenticate

      public boolean authenticate(Credentials creds) throws TimeoutException

      Authenticate with the strongest offered authentication scheme.

      Parameters:
      creds - The credentials to be used for the authentication
      Returns:
      true if successful
      Throws:
      TimeoutException - if reaching a timeout while reading
    • authenticate

      public boolean authenticate(Credentials creds, SaslMechanisms mech) throws TimeoutException

      Authenticate with the specified SASL mechanism.

      Parameters:
      creds - the credentials to be used
      mech - the SASL mechanism to be used
      Returns:
      true if successful
      Throws:
      TimeoutException - if reaching a timeout while reading
    • sendCommand

      public String[] sendCommand(String command) throws TimeoutException

      Send a command to an IMAP server.

      This is a blocking command honoring timeouts. The Timeout used is the default timeout.

      Parameters:
      command - the command to be issued
      Returns:
      an array of lines gotten in return of the command
      Throws:
      TimeoutException - if a timeout has bee reached
    • sendCommand

      public String[] sendCommand(String command, long millisTimeout) throws TimeoutException

      Send a command to an IMAP server.

      This is a blocking command honoring timeouts. The Timeout used is the default timeout.

      Parameters:
      command - the command to be issued
      millisTimeout - The timeout in milliseconds
      Returns:
      an array of lines gotten in return of the command
      Throws:
      TimeoutException - if a timeout has bee reached
    • processLine

      public void processLine(String line) throws IOException, TimeoutException
      Throws:
      IOException
      TimeoutException
    • run

      public void run()

      the processing methode of the running thread.

      Do not call this method!

      FIXME: move to a private runner.