If the user/password is complete wrong the connection will not be established. In this case you will get such behaviour.
If the user/password is correct but the role permission is wrong you will get a
Caused by: javax.ejb.EJBAccessException: JBAS014502: Invocation on method: <method> of bean: <bean> is not allowed
It is the first case I am concerned with. Since the Swing application is authenticating as part of making the remote call, I want to distinguish between an authentication failure and other failures like the remote EJB is not available.