### Question:
StreamingTemplate extends AbstractTwitterOperations implements StreamingOperations { public Stream filter(String trackKeywords, List<StreamListener> listeners) { return filter((FilterStreamParameters) new FilterStreamParameters().track(trackKeywords), listeners); } StreamingTemplate(RestTemplate restTemplate, boolean isAuthorizedForUser, boolean isAuthorizedForApp); Stream firehose(final List<StreamListener> listeners); Stream firehose(final int backfill, final List<StreamListener> listeners); Stream sample(final List<StreamListener> listeners); Stream filter(String trackKeywords, List<StreamListener> listeners); Stream filter(final FilterStreamParameters parameters, final List<StreamListener> listeners); Stream user(List<StreamListener> listeners); Stream user(final UserStreamParameters parameters, final List<StreamListener> listeners);  }### Answer:
@Test @Ignore public void filter() throws Exception { mockServer.expect(requestTo("https: .andExpect(method(POST)) .andExpect(content().string("track=dallas")) .andRespond(withSuccess(new ClassPathResource("filter-stream-track.json"), APPLICATION_JSON)); MockStreamListener listener = new MockStreamListener(7) { protected void shutdown() { } }; twitter.streamingOperations().filter("dallas", Arrays.<StreamListener>asList(listener)); Thread.sleep(1000); assertEquals(4, listener.tweetsReceived.size()); assertEquals(2, listener.deletesReceived.size()); assertEquals(1, listener.limitsReceived.size()); }
@Test @Ignore public void filter_streamClosedByTwitter() throws Exception { for(int i=0;i<3;i++) { mockServer.expect(requestTo("https: .andExpect(method(POST)) .andExpect(content().string("track=dallas")) .andRespond(withSuccess(new ClassPathResource("filter-stream-track.json"), APPLICATION_JSON)); } MockStreamListener listener = new MockStreamListener(21) { protected void shutdown() { } }; twitter.streamingOperations().filter("dallas", Arrays.<StreamListener>asList(listener)); Thread.sleep(1000); assertEquals(12, listener.tweetsReceived.size()); assertEquals(6, listener.deletesReceived.size()); assertEquals(3, listener.limitsReceived.size()); }