Class ImapPassthruServer

java.lang.Object
net.messagevortex.transport.imap.ImapPassthruServer

public class ImapPassthruServer extends Object
  • Constructor Details

    • ImapPassthruServer

      public ImapPassthruServer(InetSocketAddress listeningAddress, SecurityContext context, Credentials listeningCredentials, InetSocketAddress forwardingServer, Credentials forwardingCredentials) throws IOException

      Create an IMAP passthru proxy server.

      Parameters:
      listeningAddress - listening address for the incomming proxy port
      context - the security context for the proxy sever
      listeningCredentials - credentials for the listening proxy
      forwardingServer - IMAP address of the proxied server
      forwardingCredentials - credentials for the proxied IMAP server
      Throws:
      IOException - if start of proxy fails
  • Method Details

    • shutdown

      public void shutdown() throws IOException
      Throws:
      IOException
    • getUsernameFromUrl

      public static String getUsernameFromUrl(String url) throws ParseException

      Retrieves the username from an IMAPUrl string.

      Parameters:
      url - the URL to extract the port
      Returns:
      the username or null if none
      Throws:
      ParseException - if URL does not follow specification
      NullPointerException - if url is null
    • getPasswordFromUrl

      public static String getPasswordFromUrl(String url) throws ParseException

      Retrieves the password from an IMAPUrl string.

      Parameters:
      url - the URL to extract the port
      Returns:
      the encoded password or null if none
      Throws:
      ParseException - if URL does not follow specification
      NullPointerException - if url is null
    • getProtocolFromUrl

      public static String getProtocolFromUrl(String url) throws ParseException

      retrieves the protocol string from an IMAPUrl string.

      Parameters:
      url - the URL to extract the port
      Returns:
      the protocol string
      Throws:
      ParseException - if URL does not follow specification
      NullPointerException - if url is null
    • getPortFromUrl

      public static int getPortFromUrl(String url) throws ParseException

      retrieves the port number from an IMAPUrl string.

      Parameters:
      url - the URL to extract the port
      Returns:
      the port number
      Throws:
      ParseException - if URL does not follow specification
      NullPointerException - if url is null
    • getSocketAddressFromUrl

      public static InetSocketAddress getSocketAddressFromUrl(String url) throws ParseException

      Convert an imap URL to a scket address with apropriate port.

      Parameters:
      url - the URL to be cconvertde
      Returns:
      An equivalent socket address
      Throws:
      ParseException - if the pattern doeas not match a regular imap url
      NullPointerException - if the URL is null