private void doClose(CloseCode code, String reason, boolean initiatedByRemote) { if (this.state == State.CLOSED) { return; } if (this.in != null) { try { this.in.close(); } catch (IOException e) { NanoWSD.LOG.log(Level.FINE, "close failed", e); } } if (this.out != null) { try { this.out.close(); } catch (IOException e) { NanoWSD.LOG.log(Level.FINE, "close failed", e); } } this.state = State.CLOSED; onClose(code, reason, initiatedByRemote); }