> > I think the correct way to approach your problem is the keepAlive option > and NOT the soTimeout option.
The run() method should have two exceptions commented out: // catch (SocketTimeoutException e) { // } // catch (InterruptedIOException e) { // } Because the SocketTimeoutException is an InterruptIOException. Note that the soTimeout option is not of much use because when you specify 10000 this will have the effect that any functional but idle connection is dropped by the broker after 10 seconds. You could set it to e.g. 90000, larger than the normal periodic idle connection handshake (I don't know what that default time is, 30 seconds?), but I'm not sure if this would result in earlier detection of dead connections... Tom