@Override public void run() { Log.v(TAG, "Established object stream with " + remoteDevice.toString()); while (true) { try { listener.onReceive(remoteDevice, (Serializable) objInput.readObject()); Log.v(TAG, "Received object from " + remoteDevice.toString()); } catch (IOException e) { Log.v(TAG, "IO error in comm channel with " + remoteDevice.toString()); listener.onReceiveError(remoteDevice); close(); break; } catch (ClassNotFoundException e) { Log.e(TAG, "Object mismatch exception in comm channel with " + remoteDevice.toString(), e); listener.onReceiveError(remoteDevice); close(); break; } } }