title: Stream Closed error in twitter4j how to solve
body: <p>it says Stream Closed error</p>
  
  <pre><code>public class StreamAPI {
  
      public static void main(String[] args) {
  
  
          ConfigurationBuilder cb = new ConfigurationBuilder();
          cb.setDebugEnabled(true);
          cb.setOAuthConsumerKey("xxxx");
          cb.setOAuthConsumerSecret("xxx");
          cb.setOAuthAccessToken("xx-xx");
          cb.setOAuthAccessTokenSecret("xxx");
          cb.setUseSSL(true);
          cb.setUserStreamRepliesAllEnabled(true);
  
  
          TwitterStream twitterStream = new TwitterStreamFactory(cb.build()).getInstance();
  
          AccessToken accestoken = new AccessToken("xx-xx", "xxx");
  
          twitterStream.setOAuthAccessToken(accestoken);
          StatusListener listener = new StatusListener() {
  
              public void onStatus(Status status) {
                  System.out.println("@" + status.getUser().getScreenName() + " - " + status.getText());
              }
  
              public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) {
                  System.out.println("Got a status deletion notice id:" + statusDeletionNotice.getStatusId());
              }
  
              public void onTrackLimitationNotice(int numberOfLimitedStatuses) {
                  System.out.println("Got track limitation notice:" + numberOfLimitedStatuses);
              }
  
              public void onScrubGeo(long userId, long upToStatusId) {
                  System.out.println("Got scrub_geo event userId:" + userId + " upToStatusId:" + upToStatusId);
              }
  
              @Override
              public void onStallWarning(StallWarning stallWarning) {
                  //To change body of implemented methods use File | Settings | File Templates.
              }
  
              public void onException(Exception ex) {
                  ex.printStackTrace();
              }
          };
  
          FilterQuery fq = new FilterQuery();
          String keywords[] = {"France", "Germany"};
  
          fq.track(keywords);
  
          twitterStream.addListener(listener);
          twitterStream.filter(fq);
  
      }
  
  }
  </code></pre>
  
  <p>i am getting error </p>
  
  <pre><code>   Stream closed.
  Relevant discussions can be found on the Internet at:
      http://www.google.co.jp/search?q=a8fd061d or
      http://www.google.co.jp/search?q=00070a0c
  TwitterException{exceptionCode=[a8fd061d-00070a0c a8fd061d-0007099d], statusCode=-1, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=3.0.3}
      at twitter4j.StatusStreamBase.handleNextElement(StatusStreamBase.java:199)
      at twitter4j.StatusStreamImpl.next(StatusStreamImpl.java:57)
      at twitter4j.TwitterStreamImpl$TwitterStreamConsumer.run(TwitterStreamImpl.java:478)
  Caused by: java.io.IOException: the end of the stream has been reached
      at twitter4j.StatusStreamBase.handleNextElement(StatusStreamBase.java:88)
      ... 2 more
  </code></pre>
  
  <p>But the same configuration works for TwitterAPI                              </p>