client有如下伪代码:try{
Socket ss = new Socket();
ss.connect(new InetSocketAddress(127.0.0.1, TCPServer.LISTEN_PORT), 4000);
ss.setSoTimeout(5000);
//dosomthing
InputStream is = ss.getInputStrean();
log.info("read start time:" + System.currentTimeMillis()) int r = is.read(....);
log.info("read start time:" + System.currentTimeMillis())
} catch(Exception e){
log.info("throw exception time:" + System.currentTimeMillis());
}
上面这样的逻辑,ss.setSoTimeout(5000);把读超时设置为5000ms,可经过测试read的时间也不过才619ms 就抛出了如题的异常?