This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Any ideas why this is happening? I thought the stop method would exit gracefully from the thread...
What is happening is ... the stop flag is only checked when the readline() method returns, which in this case, is caused by an exception thrown when the socket is closed.
What you need to do is, in your catch block, is check to see if the stop condition is true. If it is, then you need to ignore the exception, don't print out the exception, and cleanup and exit gracefully.