Using SipPhone.register(...) with wrong credentials results in indefinitely blocking the calling thread and sending infinitely many REGISTER requests, if the other party responds with "401 Unauthorized" instead of "403 Forbidden".
The issue can be reproduced with pjsip on Asterisk 13, trying to register with invalid credentials. See the attached wireshark trace.
I think the solution could be as easy as checking the result of the authenticated registration message, and if it is a "401 Unauthorized" then exit the registration sending loop.
sip_registration_loop.zip