diff --git a/src/protocol/tcp/src/main/java/org/apache/jmeter/protocol/tcp/sampler/BinaryTCPClientImpl.java b/src/protocol/tcp/src/main/java/org/apache/jmeter/protocol/tcp/sampler/BinaryTCPClientImpl.java index 2971aab578..7965271da7 100644 --- a/src/protocol/tcp/src/main/java/org/apache/jmeter/protocol/tcp/sampler/BinaryTCPClientImpl.java +++ b/src/protocol/tcp/src/main/java/org/apache/jmeter/protocol/tcp/sampler/BinaryTCPClientImpl.java @@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.net.SocketTimeoutException; import org.apache.jmeter.samplers.SampleResult; import org.apache.jmeter.util.JMeterUtils; @@ -133,15 +134,20 @@ public class BinaryTCPClientImpl extends AbstractTCPClient { break; } } - - final String hexString = JOrphanUtils.baToHexString(w.toByteArray()); - if(log.isDebugEnabled()) { - log.debug("Read: " + w.size() + "\n" + hexString); + } catch (SocketTimeoutException e) { + if (useEolByte) { + throw new ReadException("Socket timed out while looking for EOM", e, + JOrphanUtils.baToHexString(w.toByteArray())); } - return hexString; + log.debug("Ignoring SocketTimeoutException, as we are not looking for EOM", e); } catch (IOException e) { - throw new ReadException("", e, JOrphanUtils.baToHexString(w.toByteArray())); + throw new ReadException("Problems while trying to read", e, JOrphanUtils.baToHexString(w.toByteArray())); + } + final String hexString = JOrphanUtils.baToHexString(w.toByteArray()); + if(log.isDebugEnabled()) { + log.debug("Read: {}\n{}", w.size(), hexString); } + return hexString; } }