Assert for another exception in TcpNioConReadTests

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

**Cherry-pick to 4.3.x**
This commit is contained in:
Artem Bilan
2016-12-16 12:58:17 -05:00
parent f7a6d69c0a
commit 968812c90b
2 changed files with 4 additions and 4 deletions

View File

@@ -53,7 +53,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) {
@@ -67,8 +67,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;
@@ -431,7 +432,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);