public void close() { try { if (os != null) { os.write("quit\n".getBytes()); os.flush(); os.close(); } s.close(); } catch (Exception ex) { } screencapture.interrupt(); try { s.close(); } catch (Exception ex) { } try { synchronized (device) { /* * if(device != null) device.removeForward(PORT, PORT); */ } } catch (Exception ex) { } }