org.apache.jmeter.protocol.tcp.sampler

## Class AbstractTCPClient

- java.lang.Object
- - org.apache.jmeter.protocol.tcp.sampler.AbstractTCPClient

All Implemented Interfaces:
  TCPClient

Direct Known Subclasses:
  BinaryTCPClientImpl, TCPClientDecorator, TCPClientImpl

    public abstract class AbstractTCPClient
    extends Object
    implements TCPClient

Basic implementation of TCPClient interface.

### Field Summary

Fields
`protected byte` `eolByte`
`protected boolean` `useEolByte`

### Constructor Summary

Constructors
Constructor and Description
`AbstractTCPClient()`

### Method Summary

All Methods Instance Methods Concrete Methods
`String` `getCharset()` Get the charset.
`byte` `getEolByte()` Get the end-of-line/end-of-message byte.
`String` `read(InputStream is, SampleResult sampleResult)` Default implementation calls `TCPClient.read(InputStream)` for backward compatibility
`void` `setCharset(String charset)`
`void` `setEolByte(int eolInt)` Set the end-of-line/end-of-message byte.
`void` `setupTest()` Invoked when the thread starts.
`void` `teardownTest()` Invoked when the thread ends

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.jmeter.protocol.tcp.sampler.TCPClient

`read, write, write`

### Field Detail

#### eolByte

    protected byte eolByte

#### useEolByte

    protected boolean useEolByte

### Constructor Detail

#### AbstractTCPClient

    public AbstractTCPClient()

### Method Detail

#### getEolByte

    public byte getEolByte()

Get the end-of-line/end-of-message byte.

Specified by:
  `getEolByte` in interface `TCPClient`
Returns:
  Returns the eolByte.

#### setEolByte

    public void setEolByte(int eolInt)

Set the end-of-line/end-of-message byte. If the value is out of range of a byte, then it is to be ignored.

Specified by:
  `setEolByte` in interface `TCPClient`
Parameters:
  `eolInt` - The value to set

#### setupTest

    public void setupTest()

Invoked when the thread starts.

Specified by:
  `setupTest` in interface `TCPClient`

#### teardownTest

    public void teardownTest()

Invoked when the thread ends

Specified by:
  `teardownTest` in interface `TCPClient`

#### getCharset

    public String getCharset()

Description copied from interface: `TCPClient`
Get the charset.

Specified by:
  `getCharset` in interface `TCPClient`
Returns:
  the charset

#### setCharset

    public void setCharset(String charset)

Parameters:
  `charset` - the charset to set

#### read

    public String read(InputStream is,
                       SampleResult sampleResult)
                throws ReadException

Default implementation calls `TCPClient.read(InputStream)` for backward compatibility

Specified by:
  `read` in interface `TCPClient`
Parameters:
  `is` - - InputStream for socket
  `sampleResult` - `SampleResult`
Returns:
  String read from socket
Throws:
  `ReadException` - exception that can contain partial response
See Also:
  `TCPClient.read(java.io.InputStream, org.apache.jmeter.samplers.SampleResult)`