title: Webbit websocket ws:// connection works but wss:// handshake fails silently without any error?
body: <p>Upgraded Webbit to 0.4.6 to use the new SSL support but immediately realized that all wss:// handshakes are failing silently and I don't have any errors to show for it. Chrome only reports a "success" for a response without a HTTP code or any other headers. I check server logs and it doesn't even register an "open" event.</p>
  
  <p>The catch here is that any ws:// connection works great. So what could be possible problems and how can I get an error out of it? Could it be something wrong with the java keystore and SSL handshake?</p>
  
  <h2>Edit</h2>
  
  <p>I was able to find an openSSL command for a test handshake. Here's the output:</p>
  
  <pre><code>SSL_connect:before/connect initialization
  SSL_connect:SSLv2/v3 write client hello A
  SSL_connect:error in SSLv2/v3 read server hello A
  </code></pre>
  
  <h2>Edit 2</h2>
  
  <p>I realized I could debug this further</p>
  
  <pre><code>CONNECTED(0000016C)
  SSL_connect:before/connect initialization
  write to 0x1f57750 [0x1f6a730] (210 bytes =&gt; 210 (0xD2))
  0000 - 16 03 01 00 cd 01 00 00-c9 03 01 4f 6b 8d 68 63   ...........Ok.hc
  0010 - 99 06 08 30 93 2a 42 88-f8 f1 c4 c5 dc 89 71 0b   ...0.*B.......q.
  0020 - b6 04 42 4e 11 79 b4 76-6c f7 66 00 00 5c c0 14   ..BN.y.vl.f..\..
  0030 - c0 0a 00 39 00 38 00 88-00 87 c0 0f c0 05 00 35   ...9.8.........5
  0040 - 00 84 c0 12 c0 08 00 16-00 13 c0 0d c0 03 00 0a   ................
  0050 - c0 13 c0 09 00 33 00 32-00 9a 00 99 00 45 00 44   .....3.2.....E.D
  0060 - c0 0e c0 04 00 2f 00 96-00 41 00 07 c0 11 c0 07   ...../...A......
  0070 - c0 0c c0 02 00 05 00 04-00 15 00 12 00 09 00 14   ................
  0080 - 00 11 00 08 00 06 00 03-00 ff 01 00 00 44 00 0b   .............D..
  0090 - 00 04 03 00 01 02 00 0a-00 34 00 32 00 01 00 02   .........4.2....
  00a0 - 00 03 00 04 00 05 00 06-00 07 00 08 00 09 00 0a   ................
  00b0 - 00 0b 00 0c 00 0d 00 0e-00 0f 00 10 00 11 00 12   ................
  00c0 - 00 13 00 14 00 15 00 16-00 17 00 18 00 19 00 23   ...............#
  00d2 - &lt;SPACES/NULS&gt;
  SSL_connect:SSLv2/v3 write client hello A
  read from 0x1f57750 [0x1f6fc90] (7 bytes =&gt; 0 (0x0))
  12488:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:.\ssl\s23_lib.c:177:
  ---
  no peer certificate available
  ---
  No client certificate CA names sent
  ---
  SSL handshake has read 0 bytes and written 210 bytes
  ---
  New, (NONE), Cipher is (NONE)
  Secure Renegotiation IS NOT supported
  Compression: NONE
  Expansion: NONE
  ---
  </code></pre>
  
  <h2>Edit 3</h2>
  
  <p>Ok I've nailed the problem to Webbit initialization, but it doesn't throw any errors so I could use some input to getting <code>getResourceAsStream</code> functioning properly. Here's how the server is initialized:</p>
  
  <pre><code>def startWebSocketServer(webSocketHandler:PartialFunction[WebSocketEvent, Unit]) {
      val webServer = WebServers.createWebServer(port)
      try {
        webServer.setupSsl(getClass.getResourceAsStream("/keystore"), "webbit")
        webServer.add("/", new WebSocketEventAdapter(webSocketHandler))
        webServer.start
      } catch {
        case e =&gt; e.printStackTrace()
      }
    }
  </code></pre>
  
  <p>Unfortunately <code>setupSsl</code> won't output any information, and I've tried both what I thought would be the path and inserting a fake path. In either case, I can't get an error. How on earth would I properly locate the path? Thanks!</p>