java: Fix callback dispatch stopping on disconnect

Callbacks could still get dispatched while the socket was already closed.
This resulted in a guaranteed timeout exceptions for getters called from
callback functions.

Use an additional lock to serialize disconnection and callback dispatch.
c: Reuse ipcon_disconnect_unlocked in ipcon_connect_unlocked

Also don't malloc receive_thread anymore.
python: Check if receive thread exists before joining it
c: Send a packet at least every 10sec to improve WIFI disconnect detection

Otherwise a callback based program might never detect WIFI disconnect.
java: Fix race condition in socket closing on socket receive error

Avoid closing the wrong socket, if the disconnect callback is delayed
and a new socket has been opened in the meantime.

Also handle socket error on send.
java: Send a packet at least every 10sec to improve WIFI disconnect detection

Otherwise a callback based program might never detect WIFI disconnect.
python: Send a packet at least every 10sec to improve WIFI disconnect detection

Otherwise a callback based program might never detect WIFI disconnect.
c: Destroy callback thread again if disconnect probe thread can not be created
python: Reset disconnect probe flag properly on successful send