in src/main/java/com/microsoft/azure/proton/transport/ws/impl/WebSocketUpgrade.java [77:111]
public String createUpgradeRequest() {
if (this.host.isEmpty()) {
throw new InvalidParameterException("host header has no value");
}
if (this.protocol.isEmpty()) {
throw new InvalidParameterException("protocol header has no value");
}
this.webSocketKey = createWebSocketKey();
final String endOfLine = "\r\n";
final StringBuilder stringBuilder = new StringBuilder()
.append("GET https://")
.append(this.host)
.append(this.path)
.append(this.query)
.append(" HTTP/1.1").append(endOfLine)
.append("Connection: Upgrade,Keep-Alive").append(endOfLine)
.append("Upgrade: websocket").append(endOfLine)
.append("Sec-WebSocket-Version: 13").append(endOfLine)
.append("Sec-WebSocket-Key: ").append(this.webSocketKey).append(endOfLine)
.append("Sec-WebSocket-Protocol: ").append(this.protocol).append(endOfLine)
.append("Host: ").append(this.host).append(endOfLine);
if (additionalHeaders != null) {
for (Map.Entry<String, String> entry : additionalHeaders.entrySet()) {
stringBuilder.append(entry.getKey()).append(": ").append(entry.getValue()).append(endOfLine);
}
}
stringBuilder.append(endOfLine);
return stringBuilder.toString();
}