Source:
<code>protected boolean handleReadException(Exception e) { boolean doClose = true; if (!this.isServer() && e instanceof SocketTimeoutException) { long now = System.currentTimeMillis(); try { int soTimeout = this.socket.getSoTimeout(); if (now - this.lastSend < soTimeout && now - this.lastRead < soTimeout * 2) { doClose = false; } else { this.setTimedOut(true); } if (!doClose && logger.isDebugEnabled()) { logger.debug("Skipping a socket timeout because we have a recent send " + this.getConnectionId()); <START> } <END> } catch (SocketException e1) { logger.error("Error accessing soTimeout", e1); doClose = true; } } if (doClose) { boolean noReadErrorOnClose = this.isNoReadErrorOnClose(); this.closeConnection(); if (!(e instanceof SoftEndOfStreamException)) { if (e instanceof SocketTimeoutException && this.isSingleUse()) { if (logger.isDebugEnabled()) { logger.debug("Closed single use socket after timeout:" + this.getConnectionId()); } } else { if (noReadErrorOnClose) { if (logger.isTraceEnabled()) { logger.trace("Read exception " + this.getConnectionId(), e); } else if (logger.isDebugEnabled()) { logger.debug("Read exception " + this.getConnectionId() + " " + e.getClass().getSimpleName() + ":" + (e.getCause() != null ? e.getCause() + ":" : "") + e.getMessage()); } } else if (logger.isTraceEnabled()) { logger.error("Read exception " + this.getConnectionId(), e); } else { logger.error("Read exception " + this.getConnectionId() + " " + e.getClass().getSimpleName() + ":" + (e.getCause() != null ? e.getCause() + ":" : "") + e.getMessage()); } this.sendExceptionToListener(e); } } } return doClose; }</code><technical_language>Do need this.setTimedOut(true); in SocketException catch below? I mean, if decided close connection, close socket too..</technical_language>

Target:
protected boolean handleReadException(Exception e) { boolean doClose = true; if (!this.isServer() && e instanceof SocketTimeoutException) { long now = System.currentTimeMillis(); try { int soTimeout = this.socket.getSoTimeout(); if (now - this.lastSend < soTimeout && now - this.lastRead < soTimeout * 2) { doClose = false; } if (!doClose && logger.isDebugEnabled()) { logger.debug("Skipping a socket timeout because we have a recent send " + this.getConnectionId()); } } catch (SocketException e1) { logger.error("Error accessing soTimeout", e1); } } if (doClose) { boolean noReadErrorOnClose = this.isNoReadErrorOnClose(); this.closeConnection(true); if (!(e instanceof SoftEndOfStreamException)) { if (e instanceof SocketTimeoutException && this.isSingleUse()) { if (logger.isDebugEnabled()) { logger.debug("Closed single use socket after timeout:" + this.getConnectionId()); } } else { if (noReadErrorOnClose) { if (logger.isTraceEnabled()) { logger.trace("Read exception " + this.getConnectionId(), e); } else if (logger.isDebugEnabled()) { logger.debug("Read exception " + this.getConnectionId() + " " + e.getClass().getSimpleName() + ":" + (e.getCause() != null ? e.getCause() + ":" : "") + e.getMessage()); } } else if (logger.isTraceEnabled()) { logger.error("Read exception " + this.getConnectionId(), e); } else { logger.error("Read exception " + this.getConnectionId() + " " + e.getClass().getSimpleName() + ":" + (e.getCause() != null ? e.getCause() + ":" : "") + e.getMessage()); } this.sendExceptionToListener(e); } } } return doClose; }