There is a duality between the surplus process of classical risk theory and the single-server queue. It follows that the probability of ruin can be retrieved from a single sample path of the waiting time process of the single-server queue. In this paper, premiums are allowed to vary. It has been shown that the stationary distribution of a corresponding storage process is equal to the survival probability (with variable premiums). Thus by simulation of the corresponding storage process, the probability of ruin can be obtained. The special cases where the surplus earns interest and the premiums are charged by layers are considered and illustrated numerically.