If you do not want to wait for one of the above to occur, you can stop a stream listener by calling the
quit() method on a
listener variable that refers to it. Note that in many cases this will also terminate the stream that is feeding the stream listener. See
Stream network lifetime.