code: func (c *connector) ReadTimeout(timeout time.Duration) (interface{}, error) {
  	for {
  		if !c.IsConnected() {
  			return nil, ErrIllegalState
  		}
  
  		doRead, msg, err := c.doPreRead()
  		if err != nil {
  			return nil, err
  		}
  
  		if !doRead {
  			return msg, nil
  		}
  
  		var complete bool
  		for {
  			if c.in.Readable() > 0 {
  				complete, msg, err = c.opts.decoder.Decode(c.in)
  
  				if !complete && err == nil {
  					complete, msg, err = c.readFromConn(timeout)
  				}
  			} else {
  				complete, msg, err = c.readFromConn(timeout)
  			}
  
  			if nil != err {
  				c.in.Clear()
  				return nil, err
  			}
  
  			if complete {
  				break
  			}
  		}
  
  		if c.in.Readable() == 0 {
  			c.in.Clear()
  		}
  
  		returnRead, readMsg, err := c.doPostRead(msg)
  		if err != nil {
  			return nil, err
  		}
  
  		if returnRead {
  			return readMsg, err
  		}
  	}
  }
docs: // ReadTimeout read data from server with a timeout duration