The main reason is a bug in android’s version of SocketSubsystem: GetLocalHostAddr method has incorrect handling of localhost (but the code is correct, it works if invert localhost detect condition)
The possible workaround is: create a ‘proxy’ layer for SocketSubsystem (similiar approach as Pimpl) and implement GetLocalHostAddr without that bug. Than you need to replace incorrect subsystem by correct one