I think you missed a previous comment. What about:
```
if (!headers.get("upgrade").equalsIgnoreCase("websocket")) {
```
instead of 
```
if (!headers.get("upgrade").toLowerCase().equals("websocket")) {
```