private int remainingTime(RemotingCommand request, int timeout) {
        InvokeContext invokeContext = request.getInvokeContext();
        if (invokeContext == null) {
            return timeout;
        }
        Long cost = invokeContext.get(InvokeContext.CLIENT_CONN_CREATETIME);
        if (cost == null) {
            return timeout;
        }

        return (int) (timeout - cost);
    }
Create invoke future with {@link InvokeContext}.
@param conn
@param request
@param invokeContext
@param invokeCallback
@return
src/main/java/com/alipay/remoting/BaseRemoting.java