1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-23 23:02:05 +01:00

[websocket] Fix getStreamFromOpenElement()

This commit is contained in:
Florian Schmaus 2021-04-01 17:39:41 +02:00
parent c484b72fb7
commit aefbb28875
2 changed files with 3 additions and 3 deletions

View file

@ -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;
}

View file

@ -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