java: Get InputStream from socket in connect function

This avoids a race condition with the receive thread if disconnect is
called directly after connect.
java: Fix byte packing for callback meta data

Packing a byte or short as int yields wrong results.

Also negative return from InputStream.read means shutdown. And error
is reported via exception.

Don't report a disconnected error if the receive thread is being
destroyed.
java: The callback thread needs its own reference to the callback queue

Otherwise the callback thread might access a null reference when the
disconnect function removes the main reference to the callback queue.
java: Change class name of enumerate example according to changed file name