private HandshakeResponse createVersionZero(HandshakeRequest handshakeRequest) {
    String challenge =
        challengeCalculator.calculateVersion1Challenge(
            handshakeRequest.getFields().get("Sec-WebSocket-Key1"),
            handshakeRequest.getFields().get("Sec-WebSocket-Key2"),
            handshakeRequest.getRandomBits());

    String message =
        "HTTP/1.1 101 WebSocket Protocol Handshake"
            + LF
            + "Upgrade: WebSocket"
            + LF
            + "Connection: Upgrade"
            + LF
            + "Sec-WebSocket-Origin: "
            + handshakeRequest.getFields().get("Origin")
            + LF
            + "Sec-WebSocket-Location: ws://localhost:"
            + WebSocketServer.getPort()
            + handshakeRequest.getPath()
            + LF
            + "Sec-WebSocket-Protocol: sample"
            + LF
            + LF
            + challenge;

    return new HandshakeResponse(message);
  }
  private HandshakeResponse createVersionSixOrHigher(HandshakeRequest handshakeRequest) {
    String secWebSocketKey = handshakeRequest.getFields().get("Sec-WebSocket-Key");
    String challenge = challengeCalculator.calculateVersion6Challenge(secWebSocketKey);

    String message =
        "HTTP/1.1 101 Switching Protocols"
            + LF
            + "Upgrade: webSocket"
            + LF
            + "Connection: Upgrade"
            + LF
            + "Sec-WebSocket-Accept: "
            + challenge
            + LF
            + LF;

    return new HandshakeResponse(message);
  }