title: Jersey SSE client is not receiving events
body: <p>I have written a rudimentary Java application to consume SSE (server-sent events) streamed from a Node.js server, using the Jersey SSE client. However, I am unable to receive the events. To verify the server component is working as expected, I used the <code>curl</code> as follows:</p>
  
  <pre><code>curl -v -H "Accept: text/event-stream" http://localhost:8080/events/
  </code></pre>
  
  <p>I get the following response:</p>
  
  <pre><code>*   Trying ::1...
  * Connected to localhost (::1) port 8080 (#0)
  &gt; GET /events/ HTTP/1.1
  &gt; Host: localhost:8080
  &gt; User-Agent: curl/7.43.0
  &gt; Accept: text/event-stream
  &gt; 
  &lt; HTTP/1.1 200 OK
  &lt; X-Powered-By: Express
  &lt; Content-Type: text/event-stream
  &lt; Cache-Control: no-cache
  &lt; Connection: keep-alive
  &lt; Date: Wed, 26 Apr 2017 17:12:00 GMT
  &lt; Transfer-Encoding: chunked
  &lt; 
  
  event: ping
  data: 0.6637400726922664
  
  event: ping
  data: 0.8538157046725585
  </code></pre>
  
  <p>The code for my SSE client in Java is as follows (Java 8, Jersey Client 1.19.3, Jersey Media SSE 2.25.1):</p>
  
  <pre><code>import org.glassfish.jersey.media.sse.EventListener;
  import org.glassfish.jersey.media.sse.EventSource;
  import org.glassfish.jersey.media.sse.InboundEvent;
  import org.glassfish.jersey.media.sse.SseFeature;
  
  import javax.ws.rs.client.Client;
  import javax.ws.rs.client.ClientBuilder;
  import javax.ws.rs.client.WebTarget;
  
  public class NodeCaptureSSE {
  
    public static void main(String[] args) {
  
      Client client = ClientBuilder.newBuilder().register(SseFeature.class).build();
      WebTarget target = client.target("http://localhost:8080/events/");
      EventSource eventSource = EventSource.target(target).build();
      EventListener listener = new EventListener() {
          @Override
          public void onEvent(InboundEvent inboundEvent) {
              System.out.println(inboundEvent.getName() + "; " + inboundEvent.readData(String.class));
          }
      };
      eventSource.register(listener, "ping");
      eventSource.open();
      System.out.println("Connected to SSE source...");
      try {
        Thread.sleep(25_000);
      }
      catch (InterruptedException ie) {
        System.err.println("Exception: " + ie.getMessage());
      }
      eventSource.close();
      System.out.println("Closed connection to SSE source");
    }
  }
  </code></pre>
  
  <p>The only output I see on the screen is:</p>
  
  <pre><code>Connected to SSE source...
  </code></pre>
  
  <p>followed by an exit, after 25 seconds. Since the server is streaming named events ("ping"), I specified that while registering the listener to the event source. Omitting the second parameter to the <code>eventSource.register(...);</code> did not do anything, although I did not expect it to. I also removed the ending <code>/</code> in the URL, but that yields a <code>404 Not Found</code> (as expected). I hope to get any pointers in the right direction.</p>