public void stop() { if (thread != null) { thread.stop(); thread = null; } try { if (console != null) console.close(); if (streamOut != null) streamOut.close(); if (socket != null) socket.close(); } catch (IOException ioe) { System.out.println("Error closing ..."); } client.close(); client.stop(); }