title: How do I create an embedded WebSocket server Jetty 9?
body: <p>I hate asking such a vague question, but I'm having a hard time finding a simple example.  Here's what I have so far:</p>
  
  <pre><code>public class JettyWebSocketServlet extends WebSocketServlet{
      @Override
      public void configure(WebSocketServletFactory factory) {
          factory.register(MyEchoSocket.class);
      }
  }
  
  @WebSocket
  public class MyEchoSocket {
      @OnWebSocketMessage
      public void onText(WebSocketConnection conn, String message) {
          System.out.println("text: " + message);
          try {
              conn.write(null, new FutureCallback(), "got: " + message);
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>The embedded Jetty examples I can find always show something like the following, to start a Server instance running, but I don't know how to instantiate my WebSocketServlet.</p>
  
  <pre><code>        Server server = new Server(8080);
          server.start();
          server.join();
  </code></pre>
  
  <p>How do I create an embedded server that can handle WebSocket connection requests?</p>