TCP Protocol

Any service that communicates over the TCP protocol is Testable.

When creating a new test target use the following URL formats:




If you choose to define your scenario by writing a script you have access to the Node.js net and tls modules.


Both HTTP and Web Sockets work over TCP of course, but they have special support in the Testable platform where we leverage protocol features such as:

  • Using HTTP Host header to indicate the MITM gateway key (i.e. http://{key}
  • Capturing the Content-Type of the response
  • Capturing the response code of the response

With raw TCP services there aren't any headers, so we can't use the Host header to tell the MITM gateway which service to route traffic to or into which recording to persist. While recording, each time a client opens a TCP socket to the MITM TCP gateway (i.e. {key} @ it must send the following UTF-8 encoded bytes first:

TestableGateway {key}\n

This tells the gateway which backend service and recording to use. Below is an example that utilizes the Testable Sample TCP Service which is accessible at tcp:// This is a simple echo service that writes back any data sent to it.


If you click on the connection the packets grid below will show you all the traffic sent/received over the connection (the Packets Grid also updates in real time).


To capture the traffic for the recording, we use the following Scala code:


object GatewayEchoTestClient extends App {
  val socket = new Socket("", 8091)
  var in = socket.getInputStream
  val out = new PrintStream(socket.getOutputStream)

  out.print("TestableGateway \nThis is some test data!")
  val data = new Array[Byte](100)

  println("Client received: " + new String(data))


During test execution the recorded steps will be replayed. The agent will use the received traffic from the server to decide how long to wait for incoming packets and whether or not the test succeeded.


The platform captures a variety of stats for each TCP connection opened during test execution. Additional custom metrics can be added by first converting the recording into a script.