Assert for another exception in TcpNioConReadTests

https://build.spring.io/browse/INT-MJATS41-847/

**Cherry-pick to 4.3.x**

(cherry picked from commit 968812c)
This commit is contained in:
Artem Bilan
2016-12-16 12:58:17 -05:00
parent 3127f25bfe
commit 21d355c538
2 changed files with 4 additions and 4 deletions

View File

@@ -48,7 +48,7 @@ public class ByteArrayCrLfSerializer extends AbstractPooledBufferByteArraySerial
int n = 0;
int bite;
if (logger.isDebugEnabled()) {
logger.debug("Available to read:" + inputStream.available());
logger.debug("Available to read: " + inputStream.available());
}
try {
while (true) {
@@ -62,8 +62,7 @@ public class ByteArrayCrLfSerializer extends AbstractPooledBufferByteArraySerial
}
buffer[n++] = (byte) bite;
if (n >= this.maxMessageSize) {
throw new IOException("CRLF not found before max message length: "
+ this.maxMessageSize);
throw new IOException("CRLF not found before max message length: " + this.maxMessageSize);
}
}
return n - 1; // trim \r

View File

@@ -16,6 +16,7 @@
package org.springframework.integration.ip.tcp.connection;
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
@@ -454,7 +455,7 @@ public class TcpNioConnectionReadTests {
assertTrue(errorMessageLetch.await(10, TimeUnit.SECONDS));
assertThat(errorMessageRef.get().getMessage(),
containsString("Connection is closed"));
anyOf(containsString("Connection is closed"), containsString("Socket closed during message assembly")));
assertTrue(semaphore.tryAcquire(10000, TimeUnit.MILLISECONDS));
assertTrue(removed.size() > 0);