The standard server ports used for POP3 and IMAP protocols are 110 and 143 respectively. For a secure connection over SSL/TLS the ports are 995 for POP3 and 993 for IMAP.
In case your connection attempts are refused by the POP3 or IMAP server, the most probable cause is a block on the IMAP/POP3 port you are using.
You test connectivity to your mail server on that specific port using Telnet. To do so follow the steps in this article.