title: Websocket session.close in @OnOpen results in server freeze
body: <p>I have a problem with a websocket in Java EE 7.
  I tried to reject a connection in the @OnOpen annotated method. To close the connection I use session.close(). But after a few times the sever freeze. </p>
  
  <p>Here is a short example. This example is based on the netbeans WebSocket Echo Sample Application. After a few message, the server freezes. No Exception is thrown.</p>
  
  <p>Do I miss something? How do I reject a connection correctly?</p>
  
  <p>I use Glassfish 4.0.</p>
  
  <pre><code>@ServerEndpoint("/echo")
  public class EchoEndpoint {
  
    @OnMessage
    public String echo(String message) {
      return message;
    }
  
    @OnOpen
    public void onOpen(Session session) {
      try {
        session.close();
      } catch (IOException ex) {
        Logger.getLogger(EchoEndpoint.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
  }
  </code></pre>