fusesource / mqtt-client

A Java MQTT Client
http://mqtt-client.fusesource.org/
Apache License 2.0
1.27k stars 369 forks source link

Meet Peer disconnected error when create two connection to different servers. #86

Open lemonbar opened 7 years ago

lemonbar commented 7 years ago

Hello, fusesource

I used mqtt-client to instantiate two MQTT, connect to different servers at the same time, and meet peer disconnected error.

I debug the code, and found this error was thrown in AbstractProtocolCodec.read readCounter += lastReadIoSize; if (lastReadIoSize == -1) { readCounter += 1; // to compensate for that -1 throw new EOFException("Peer disconnected"); } else if (lastReadIoSize == 0) { if ( readStart == readBuffer.position() ) { if (candidateForCheckin) { readBufferPool.checkin(readBuffer.array()); } readStart = 0; readEnd = 0; readBuffer = null; } return null; }

Thanks very much in advance if you can give me some suggestion.