Search in sources :

Example 1 with XmlReader

use of de.pixart.messenger.xml.XmlReader in project Pix-Art-Messenger by kriztan.

the class XmppConnection method startXmpp.

/**
 * Starts xmpp protocol, call after connecting to socket
 *
 * @return true if server returns with valid xmpp, false otherwise
 */
private boolean startXmpp(Socket socket) throws Exception {
    if (Thread.currentThread().isInterrupted()) {
        throw new InterruptedException();
    }
    this.socket = socket;
    tagReader = new XmlReader();
    if (tagWriter != null) {
        tagWriter.forceClose();
    }
    tagWriter = new TagWriter();
    tagWriter.setOutputStream(socket.getOutputStream());
    tagReader.setInputStream(socket.getInputStream());
    tagWriter.beginDocument();
    sendStartStream();
    final Tag tag = tagReader.readTag();
    return tag != null && tag.isStart("stream");
}
Also used : TagWriter(de.pixart.messenger.xml.TagWriter) XmlReader(de.pixart.messenger.xml.XmlReader) Tag(de.pixart.messenger.xml.Tag)

Aggregations

Tag (de.pixart.messenger.xml.Tag)1 TagWriter (de.pixart.messenger.xml.TagWriter)1 XmlReader (de.pixart.messenger.xml.XmlReader)1