[websocket] Fix getStreamFromOpenElement()

master
Florian Schmaus 2 years ago
parent c484b72fb7
commit aefbb28875
  1. 4
      smack-websocket/src/main/java/org/jivesoftware/smack/websocket/impl/AbstractWebSocket.java
  2. 2
      smack-websocket/src/test/java/org/jivesoftware/smack/websocket/impl/AbstractWebSocketTest.java

@ -93,9 +93,9 @@ public abstract class AbstractWebSocket {
}
static String getStreamFromOpenElement(String openElement) {
String streamElement = openElement.replaceFirst("\\A<open ", "<stream ")
String streamElement = openElement.replaceFirst("\\A<open ", "<stream:stream ")
.replace("urn:ietf:params:xml:ns:xmpp-framing", "jabber:client")
.replaceFirst("/>\\s*\\z", ">");
.replaceFirst("/>\\s*\\z", " xmlns:stream='http://etherx.jabber.org/streams'>");
return streamElement;
}

@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test;
public final class AbstractWebSocketTest {
private static final String OPEN_ELEMENT = "<open from='localhost.org' id='aov9ihhmmn' xmlns='urn:ietf:params:xml:ns:xmpp-framing' xml:lang='en' version='1.0'/>";
private static final String OPEN_STREAM = "<stream from='localhost.org' id='aov9ihhmmn' xmlns='jabber:client' xml:lang='en' version='1.0'>";
private static final String OPEN_STREAM = "<stream:stream from='localhost.org' id='aov9ihhmmn' xmlns='jabber:client' xml:lang='en' version='1.0' xmlns:stream='http://etherx.jabber.org/streams'>";
private static final String CLOSE_ELEMENT = "<close xmlns='urn:ietf:params:xml:ns:xmpp-framing'/>";
@Test

Loading…
Cancel
Save