If you are seeing the user as $local you need to disable the JBOSS-LOCAL-USER SASL mechanisms on the client side.
The XNIO option for this is : -
org.xnio.Options.SASL_DISALLOWED_MECHANISMS JBOSS-LOCAL-USER
You will need to disable this both for the JNDI connection and for the EJB connection, there are example of this on the other posts discussing the same issue.