Step
1.connection.login()
Observable.create<Boolean> {
SignalOmemoService.acknowledgeLicense()
SignalOmemoService.setup()
OmemoConfiguration.setFileBasedOmemoStoreDefaultPath(File(PathManager.getOmemoStorePath()))
mOmemoManager = OmemoManager.getInstanceFor(connection)
mOmemoManager?.addOmemoMucMessageListener(this)
mOmemoManager?.addOmemoMessageListener(this)
mOmemoManager?.initialize()
mPerManager = PEPManager.getInstanceFor(connection)
mPerManager?.addPEPListener(this)
it.onComplete()
}.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
}
3.ObserableReader read an inputSteam and throw EOFException
receive response:
BQD7Yi4xh2D7G2CzaHBw0pVGkncycgbFPMxPrrWSDnsIm6HBA48lKq0kS5mDEbWKYx9NTk8TshhCmw0awW0zYsUVpyi5SeG1sCGEf3ZtSvffRr5NzEcRAsuwtqm07oJWAw==BVkVdrzbQT2I9GFRdPk8lPqqIcnC4mTiuojNyUKy+f8VBb9xJ46QpABaW9zoI4ZhDttOgtQYgHcBOd/HOv6+mWcxBWgJE96Q8/E49B8GwHHrDnu7t/11DK5mwVu9AGYVYwplBT4vbl6k4+9iUa+7DTJose2WfH75lNID8662peX7NmkVBfCurI/M5V+F2vv4F3tLPbStOq0Ws9cRz10GaX0FNLUxBeeZNhe6TKoDjygzVGuVBQRsDNDkkKmSTwzrEYC5rcA6<preKeyPublic preKeyId='9
exception:
Connection XMPPTCPConnection[35106607262242@dev-im.gzemt.cn/wchat] (0) closed with error
java.io.EOFException
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:169)
at java.io.InputStreamReader.read(InputStreamReader.java:231)
at java.io.BufferedReader.read(BufferedReader.java:325)
at org.jivesoftware.smack.util.ObservableReader.read(ObservableReader.java:42)
at org.kxml2.io.KXmlParser.fillBuffer(KXmlParser.java:1515)
at org.kxml2.io.KXmlParser.peekType(KXmlParser.java:992)
at org.kxml2.io.KXmlParser.next(KXmlParser.java:349)
at org.kxml2.io.KXmlParser.next(KXmlParser.java:313)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1286)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:1010)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:1026)
at java.lang.Thread.run(Thread.java:818)
ObservableReader:
public int read(char[] cbuf, int off, int len) throws IOException {
int count = wrappedReader.read(cbuf, off, len);
if (count > 0) {
String str = new String(cbuf, off, count);
// Notify that a new string has been read
ReaderListener[] readerListeners = null;
synchronized (listeners) {
readerListeners = new ReaderListener[listeners.size()];
listeners.toArray(readerListeners);
}
for (int i = 0; i < readerListeners.length; i++) {
readerListeners[i].read(str);
}
}
return count;
}