code: public static String hashKey(String key) {
          try {
              MessageDigest md = MessageDigest.getInstance("SHA1");
              md.update(key.getBytes(StandardCharsets.UTF_8));
              md.update(MAGIC);
              return new String(B64Code.encode(md.digest()));
          } catch (Exception e) {
              throw new RuntimeException(e);
          }
      }
docs: Concatenate the provided key with the Magic GUID and return the Base64 encoded form.
  
  @param key the key to hash
  @return the <code>Sec-WebSocket-Accept</code> header response (per opening handshake spec)