title: Why do I get a connection refused?
body: <p>I am trying to get some data from openweathermap.org via java, but when I run the code I get a ConnectionException.</p>
  
  <p>My code is:</p>
  
  <pre><code>public static void openweathermapTest1() {
      String uri = "http://openweathermap.org/data/2.1/find/station?lat=55&amp;lon=37&amp;cnt=10";
      ClientConfig config = new DefaultClientConfig();
      Client client = Client.create(config);
      WebResource service = client.resource(uri);
      String xml = service.accept(MediaType.TEXT_XML).get(String.class);
      System.out.println("Output as XML: " + xml);
  }
  </code></pre>
  
  <p>and the Exception:</p>
  
  <pre><code>Exception in thread "main"
  com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
  at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:151)
  at com.sun.jersey.api.client.Client.handle(Client.java:648)     
  at com.sun.jersey.api.client.WebResource.handle(WebResource.java:680)   
  at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
  at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:507)
  at GetPoint.openweathermapTest1(GetPoint.java:110)
  at GetPoint.main(GetPoint.java:142)
  </code></pre>
  
  <p>Strangely, when I call <a href="http://openweathermap.org/data/2.1/find/station?lat=55&amp;lon=37&amp;cnt=10" rel="nofollow">this link</a> in my web browser, I get the expected data. How can that be? What am I missing here? And how can I fix it? (I tried all three uri and all worked in firefox and not in my programm)</p>