I have a problem that happens at unregular times and I can't seem to reproduce the error when I want to. The problem is that sometimes the read method in the InputStream is blocking when I tries to read from a gps bluetooth device. I've a timer object that reads the gps at regular intervals and it usually works fine, but suddenly the thread stops because the read method is blocking. Does anyone know a way around this problem?
If I make some sort of timer object that detect the blocking, how can I stop the read method?

Have anyone experienced problem when reading from a bluetooth device?

Here is my code snippet:

InputStream is = null;
StreamConnection connection = null;
connection = (StreamConnection)Connector.open(gpsUrl);
is = connection.openInputStream();
byte[] buffer = new byte[600];
noBytes = is.read(buffer);

I've tried to test with inpustream.available(), but that always return 0.