org.apache.jmeter.protocol.tcp.sampler

## Class TCPClientDecorator

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

- All Implemented Interfaces:
    TCPClient
  Direct Known Subclasses:
    LengthPrefixedBinaryTCPClientImpl

      public abstract class TCPClientDecorator
      extends AbstractTCPClient

  TCP Sampler Client decorator to permit wrapping base client implementations with length prefixes.

  For example, character data or binary data with character length or binary length.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected TCPClient` | `tcpClient`

    - ### Fields inherited from class org.apache.jmeter.protocol.tcp.sampler.AbstractTCPClient

      `eolByte, useEolByte`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TCPClientDecorator(TCPClient tcpClient)`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `byteArrayToInt(byte[] b)` Convert byte array to int.
    `static byte[]` | `intToByteArray(int value, int len)` Convert int to byte array.

    - ### Methods inherited from class org.apache.jmeter.protocol.tcp.sampler.AbstractTCPClient

      `getCharset, getEolByte, read, setCharset, setEolByte, setupTest, teardownTest`

    - ### 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

    - #### tcpClient

          protected final TCPClient tcpClient

  - ### Constructor Detail

    - #### TCPClientDecorator

          public TCPClientDecorator(TCPClient tcpClient)

  - ### Method Detail

    - #### intToByteArray

          public static byte[] intToByteArray(int value,
                                              int len)

      Convert int to byte array.
      Parameters:
        `value` - - int to be converted
        `len` - - length of required byte array
      Returns:
        Byte array representation of input value
      Throws:
        `IllegalArgumentException` - if not length 2 or 4 or outside range of a short int.

    - #### byteArrayToInt

          public static int byteArrayToInt(byte[] b)

      Convert byte array to int.
      Parameters:
        `b` - - Byte array to be converted
      Returns:
        Integer value of input byte array
      Throws:
        `IllegalArgumentException` - if ba is null or not length 2 or 4

Copyright © 1998-2020 Apache Software Foundation. All Rights Reserved.