Did you try telnetting (or with openssl s_client -connect if SSL) to the POP/IMAP host from the server, in a ssh session?
openssl s_client -connect