diff --git a/src/vcl/CMakeLists.txt b/src/vcl/CMakeLists.txt
index 9fead60..abe1bf0 100644
--- a/src/vcl/CMakeLists.txt
+++ b/src/vcl/CMakeLists.txt
@@ -44,7 +44,6 @@
   vcl_test.h
   vppcom.h
   ldp_socket_wrapper.h
-  sock_test_common.h
 )
 
 ##############################################################################
diff --git a/src/vcl/sock_test.h b/src/vcl/sock_test.h
index 6e0b22a..83f17fa 100644
--- a/src/vcl/sock_test.h
+++ b/src/vcl/sock_test.h
@@ -20,16 +20,18 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
-#include <vcl/sock_test_common.h>
+#include <vcl/vcl_test.h>
 
 #define SOCK_TEST_AF_UNIX_FILENAME    "/tmp/ldp_server_af_unix_socket"
 #define SOCK_TEST_MIXED_EPOLL_DATA    "Hello, world! (over an AF_UNIX socket)"
 #define SOCK_TEST_AF_UNIX_ACCEPT_DATA 0xaf0000af
 #define SOCK_TEST_AF_UNIX_FD_MASK     0x00af0000
+#define SOCK_TEST_BANNER_STRING \
+  "============================================\n"
 
 static inline int
 sock_test_read (int fd, uint8_t *buf, uint32_t nbytes,
-                sock_test_stats_t *stats)
+                vcl_test_stats_t *stats)
 {
   int rx_bytes, errno_val;
   
@@ -66,7 +68,7 @@
 
 static inline int
 sock_test_write (int fd, uint8_t *buf, uint32_t nbytes,
-                 sock_test_stats_t *stats, uint32_t verbose)
+                 vcl_test_stats_t *stats, uint32_t verbose)
 {
   int tx_bytes = 0;
   int nbytes_left = nbytes;
diff --git a/src/vcl/sock_test_client.c b/src/vcl/sock_test_client.c
index de77fc9..75913d9 100644
--- a/src/vcl/sock_test_client.c
+++ b/src/vcl/sock_test_client.c
@@ -38,8 +38,8 @@
   struct sockaddr_storage server_addr;
   uint32_t server_addr_size;
   uint32_t cfg_seq_num;
-  sock_test_socket_t ctrl_socket;
-  sock_test_socket_t *test_socket;
+  vcl_test_session_t ctrl_socket;
+  vcl_test_session_t *test_socket;
   uint32_t num_test_sockets;
   uint8_t dump_cfg;
 } sock_client_main_t;
@@ -48,21 +48,21 @@
 
 
 static int
-sock_test_cfg_sync (sock_test_socket_t * socket)
+sock_test_cfg_sync (vcl_test_session_t * socket)
 {
   sock_client_main_t *scm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &scm->ctrl_socket;
-  sock_test_cfg_t *rl_cfg = (sock_test_cfg_t *) socket->rxbuf;
+  vcl_test_session_t *ctrl = &scm->ctrl_socket;
+  vcl_test_cfg_t *rl_cfg = (vcl_test_cfg_t *) socket->rxbuf;
   int rx_bytes, tx_bytes;
 
   if (socket->cfg.verbose)
-    sock_test_cfg_dump (&socket->cfg, 1 /* is_client */ );
+    vcl_test_cfg_dump (&socket->cfg, 1 /* is_client */ );
 
   ctrl->cfg.seq_num = ++scm->cfg_seq_num;
   if (socket->cfg.verbose)
     {
       printf ("CLIENT (fd %d): Sending config sent to server.\n", socket->fd);
-      sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+      vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
     }
   tx_bytes = sock_test_write (socket->fd, (uint8_t *) & ctrl->cfg,
 			      sizeof (ctrl->cfg), NULL, ctrl->cfg.verbose);
@@ -74,39 +74,39 @@
     }
 
   rx_bytes = sock_test_read (socket->fd, (uint8_t *) socket->rxbuf,
-			     sizeof (sock_test_cfg_t), NULL);
+			     sizeof (vcl_test_cfg_t), NULL);
   if (rx_bytes < 0)
     return rx_bytes;
 
-  if (rl_cfg->magic != SOCK_TEST_CFG_CTRL_MAGIC)
+  if (rl_cfg->magic != VCL_TEST_CFG_CTRL_MAGIC)
     {
       fprintf (stderr, "CLIENT (fd %d): ERROR: Bad server reply cfg "
 	       "-- aborting!\n", socket->fd);
       return -1;
     }
-  if ((rx_bytes != sizeof (sock_test_cfg_t))
-      || !sock_test_cfg_verify (rl_cfg, &ctrl->cfg))
+  if ((rx_bytes != sizeof (vcl_test_cfg_t))
+      || !vcl_test_cfg_verify (rl_cfg, &ctrl->cfg))
     {
       fprintf (stderr, "CLIENT (fd %d): ERROR: Invalid config received "
 	       "from server!\n", socket->fd);
-      if (rx_bytes != sizeof (sock_test_cfg_t))
+      if (rx_bytes != sizeof (vcl_test_cfg_t))
 	{
 	  fprintf (stderr, "\tRx bytes %d != cfg size %lu\n",
-		   rx_bytes, sizeof (sock_test_cfg_t));
+		   rx_bytes, sizeof (vcl_test_cfg_t));
 	}
       else
 	{
-	  sock_test_cfg_dump (rl_cfg, 1 /* is_client */ );
+	  vcl_test_cfg_dump (rl_cfg, 1 /* is_client */ );
 	  fprintf (stderr, "CLIENT (fd %d): Valid config sent to server.\n",
 		   socket->fd);
-	  sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+	  vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
 	}
       return -1;
     }
   else if (socket->cfg.verbose)
     {
       printf ("CLIENT (fd %d): Got config back from server.\n", socket->fd);
-      sock_test_cfg_dump (rl_cfg, 1 /* is_client */ );
+      vcl_test_cfg_dump (rl_cfg, 1 /* is_client */ );
     }
   ctrl->cfg.ctrl_handle = ((ctrl->cfg.ctrl_handle == ~0) ?
 			   rl_cfg->ctrl_handle : ctrl->cfg.ctrl_handle);
@@ -118,8 +118,8 @@
 echo_test_client ()
 {
   sock_client_main_t *scm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &scm->ctrl_socket;
-  sock_test_socket_t *tsock;
+  vcl_test_session_t *ctrl = &scm->ctrl_socket;
+  vcl_test_session_t *tsock;
   int rx_bytes, tx_bytes, nbytes;
   uint32_t i, n;
   int rv;
@@ -132,11 +132,11 @@
   FD_ZERO (&rd_fdset);
   memset (&ctrl->stats, 0, sizeof (ctrl->stats));
   ctrl->cfg.total_bytes = nbytes = strlen (ctrl->txbuf) + 1;
-  for (n = 0; n != ctrl->cfg.num_test_sockets; n++)
+  for (n = 0; n != ctrl->cfg.num_test_sessions; n++)
     {
       tsock = &scm->test_socket[n];
       tsock->cfg = ctrl->cfg;
-      sock_test_socket_buf_alloc (tsock);
+      vcl_test_session_buf_alloc (tsock);
       if (sock_test_cfg_sync (tsock))
 	return;
 
@@ -176,7 +176,7 @@
       else if (rv == 0)
 	continue;
 
-      for (i = 0; i < ctrl->cfg.num_test_sockets; i++)
+      for (i = 0; i < ctrl->cfg.num_test_sessions; i++)
 	{
 	  tsock = &scm->test_socket[i];
 	  if (!((tsock->stats.stop.tv_sec == 0) &&
@@ -316,7 +316,7 @@
   }
 #endif
 
-  for (i = 0; i < ctrl->cfg.num_test_sockets; i++)
+  for (i = 0; i < ctrl->cfg.num_test_sessions; i++)
     {
       tsock = &scm->test_socket[i];
       tsock->stats.start = ctrl->stats.start;
@@ -326,31 +326,31 @@
 	  static char buf[64];
 
 	  sprintf (buf, "CLIENT (fd %d) RESULTS", tsock->fd);
-	  sock_test_stats_dump (buf, &tsock->stats,
-				1 /* show_rx */ , 1 /* show tx */ ,
-				ctrl->cfg.verbose);
+	  vcl_test_stats_dump (buf, &tsock->stats,
+			       1 /* show_rx */ , 1 /* show tx */ ,
+			       ctrl->cfg.verbose);
 	}
 
-      sock_test_stats_accumulate (&ctrl->stats, &tsock->stats);
+      vcl_test_stats_accumulate (&ctrl->stats, &tsock->stats);
     }
 
   if (ctrl->cfg.verbose)
     {
-      sock_test_stats_dump ("CLIENT RESULTS", &ctrl->stats,
-			    1 /* show_rx */ , 1 /* show tx */ ,
-			    ctrl->cfg.verbose);
-      sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+      vcl_test_stats_dump ("CLIENT RESULTS", &ctrl->stats,
+			   1 /* show_rx */ , 1 /* show tx */ ,
+			   ctrl->cfg.verbose);
+      vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
 
       if (ctrl->cfg.verbose > 1)
 	{
 	  printf ("  ctrl socket info\n"
-		  SOCK_TEST_SEPARATOR_STRING
+		  VCL_TEST_SEPARATOR_STRING
 		  "          fd:  %d (0x%08x)\n"
 		  "       rxbuf:  %p\n"
 		  "  rxbuf size:  %u (0x%08x)\n"
 		  "       txbuf:  %p\n"
 		  "  txbuf size:  %u (0x%08x)\n"
-		  SOCK_TEST_SEPARATOR_STRING,
+		  VCL_TEST_SEPARATOR_STRING,
 		  ctrl->fd, (uint32_t) ctrl->fd,
 		  ctrl->rxbuf, ctrl->rxbuf_size, ctrl->rxbuf_size,
 		  ctrl->txbuf, ctrl->txbuf_size, ctrl->txbuf_size);
@@ -359,18 +359,18 @@
 }
 
 static void
-stream_test_client (sock_test_t test)
+stream_test_client (vcl_test_t test)
 {
   sock_client_main_t *scm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &scm->ctrl_socket;
-  sock_test_socket_t *tsock;
+  vcl_test_session_t *ctrl = &scm->ctrl_socket;
+  vcl_test_session_t *tsock;
   int tx_bytes;
   uint32_t i, n;
   int rv;
   int nfds = 0;
   fd_set wr_fdset, rd_fdset;
   fd_set _wfdset, *wfdset = &_wfdset;
-  fd_set _rfdset, *rfdset = (test == SOCK_TEST_TYPE_BI) ? &_rfdset : 0;
+  fd_set _rfdset, *rfdset = (test == VCL_TEST_TYPE_BI) ? &_rfdset : 0;
 
   ctrl->cfg.total_bytes = ctrl->cfg.num_writes * ctrl->cfg.txbuf_size;
   ctrl->cfg.ctrl_handle = ~0;
@@ -378,7 +378,7 @@
   printf ("\n" SOCK_TEST_BANNER_STRING
 	  "CLIENT (fd %d): %s-directional Stream Test!\n\n"
 	  "CLIENT (fd %d): Sending config to server on ctrl socket...\n",
-	  ctrl->fd, test == SOCK_TEST_TYPE_BI ? "Bi" : "Uni", ctrl->fd);
+	  ctrl->fd, test == VCL_TEST_TYPE_BI ? "Bi" : "Uni", ctrl->fd);
 
   if (sock_test_cfg_sync (ctrl))
     {
@@ -389,11 +389,11 @@
   FD_ZERO (&wr_fdset);
   FD_ZERO (&rd_fdset);
   memset (&ctrl->stats, 0, sizeof (ctrl->stats));
-  for (n = 0; n != ctrl->cfg.num_test_sockets; n++)
+  for (n = 0; n != ctrl->cfg.num_test_sessions; n++)
     {
       tsock = &scm->test_socket[n];
       tsock->cfg = ctrl->cfg;
-      sock_test_socket_buf_alloc (tsock);
+      vcl_test_session_buf_alloc (tsock);
       printf ("CLIENT (fd %d): Sending config to server on "
 	      "test socket %d...\n", tsock->fd, n);
       sock_test_cfg_sync (tsock);
@@ -436,14 +436,14 @@
       else if (rv == 0)
 	continue;
 
-      for (i = 0; i < ctrl->cfg.num_test_sockets; i++)
+      for (i = 0; i < ctrl->cfg.num_test_sessions; i++)
 	{
 	  tsock = &scm->test_socket[i];
 	  if (!((tsock->stats.stop.tv_sec == 0) &&
 		(tsock->stats.stop.tv_nsec == 0)))
 	    continue;
 
-	  if ((test == SOCK_TEST_TYPE_BI) &&
+	  if ((test == VCL_TEST_TYPE_BI) &&
 	      FD_ISSET (tsock->fd, rfdset) &&
 	      (tsock->stats.rx_bytes < ctrl->cfg.total_bytes))
 	    {
@@ -466,9 +466,9 @@
 		}
 	    }
 
-	  if (((test == SOCK_TEST_TYPE_UNI) &&
+	  if (((test == VCL_TEST_TYPE_UNI) &&
 	       (tsock->stats.tx_bytes >= ctrl->cfg.total_bytes)) ||
-	      ((test == SOCK_TEST_TYPE_BI) &&
+	      ((test == VCL_TEST_TYPE_BI) &&
 	       (tsock->stats.rx_bytes >= ctrl->cfg.total_bytes)))
 	    {
 	      clock_gettime (CLOCK_REALTIME, &tsock->stats.stop);
@@ -487,7 +487,7 @@
       return;
     }
 
-  for (i = 0; i < ctrl->cfg.num_test_sockets; i++)
+  for (i = 0; i < ctrl->cfg.num_test_sessions; i++)
     {
       tsock = &scm->test_socket[i];
 
@@ -496,77 +496,77 @@
 	  static char buf[64];
 
 	  sprintf (buf, "CLIENT (fd %d) RESULTS", tsock->fd);
-	  sock_test_stats_dump (buf, &tsock->stats,
-				test == SOCK_TEST_TYPE_BI /* show_rx */ ,
-				1 /* show tx */ , ctrl->cfg.verbose);
+	  vcl_test_stats_dump (buf, &tsock->stats,
+			       test == VCL_TEST_TYPE_BI /* show_rx */ ,
+			       1 /* show tx */ , ctrl->cfg.verbose);
 	}
 
-      sock_test_stats_accumulate (&ctrl->stats, &tsock->stats);
+      vcl_test_stats_accumulate (&ctrl->stats, &tsock->stats);
     }
 
-  sock_test_stats_dump ("CLIENT RESULTS", &ctrl->stats,
-			test == SOCK_TEST_TYPE_BI /* show_rx */ ,
-			1 /* show tx */ , ctrl->cfg.verbose);
-  sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+  vcl_test_stats_dump ("CLIENT RESULTS", &ctrl->stats,
+		       test == VCL_TEST_TYPE_BI /* show_rx */ ,
+		       1 /* show tx */ , ctrl->cfg.verbose);
+  vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
 
   if (ctrl->cfg.verbose)
     {
       printf ("  ctrl socket info\n"
-	      SOCK_TEST_SEPARATOR_STRING
+	      VCL_TEST_SEPARATOR_STRING
 	      "          fd:  %d (0x%08x)\n"
 	      "       rxbuf:  %p\n"
 	      "  rxbuf size:  %u (0x%08x)\n"
 	      "       txbuf:  %p\n"
 	      "  txbuf size:  %u (0x%08x)\n"
-	      SOCK_TEST_SEPARATOR_STRING,
+	      VCL_TEST_SEPARATOR_STRING,
 	      ctrl->fd, (uint32_t) ctrl->fd,
 	      ctrl->rxbuf, ctrl->rxbuf_size, ctrl->rxbuf_size,
 	      ctrl->txbuf, ctrl->txbuf_size, ctrl->txbuf_size);
     }
 
-  ctrl->cfg.test = SOCK_TEST_TYPE_ECHO;
+  ctrl->cfg.test = VCL_TEST_TYPE_ECHO;
   if (sock_test_cfg_sync (ctrl))
     fprintf (stderr, "CLIENT: ERROR: post-test cfg sync failed!");
 
   printf ("CLIENT (fd %d): %s-directional Stream Test Complete!\n"
 	  SOCK_TEST_BANNER_STRING "\n", ctrl->fd,
-	  test == SOCK_TEST_TYPE_BI ? "Bi" : "Uni");
+	  test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
 }
 
 static void
 exit_client (void)
 {
   sock_client_main_t *scm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &scm->ctrl_socket;
-  sock_test_socket_t *tsock;
+  vcl_test_session_t *ctrl = &scm->ctrl_socket;
+  vcl_test_session_t *tsock;
   int i;
 
 #ifndef VCL_TEST
   printf ("CLIENT: af_unix_echo_tx %d, af_unix_echo_rx %d\n",
 	  scm->af_unix_echo_tx, scm->af_unix_echo_rx);
 #endif
-  for (i = 0; i < ctrl->cfg.num_test_sockets; i++)
+  for (i = 0; i < ctrl->cfg.num_test_sessions; i++)
     {
       tsock = &scm->test_socket[i];
-      tsock->cfg.test = SOCK_TEST_TYPE_EXIT;
+      tsock->cfg.test = VCL_TEST_TYPE_EXIT;
 
       /* coverity[COPY_PASTE_ERROR] */
       if (ctrl->cfg.verbose)
 	{
 	  printf ("\nCLIENT (fd %d): Sending exit cfg to server...\n",
 		  tsock->fd);
-	  sock_test_cfg_dump (&tsock->cfg, 1 /* is_client */ );
+	  vcl_test_cfg_dump (&tsock->cfg, 1 /* is_client */ );
 	}
       (void) sock_test_write (tsock->fd, (uint8_t *) & tsock->cfg,
 			      sizeof (tsock->cfg), &tsock->stats,
 			      ctrl->cfg.verbose);
     }
 
-  ctrl->cfg.test = SOCK_TEST_TYPE_EXIT;
+  ctrl->cfg.test = VCL_TEST_TYPE_EXIT;
   if (ctrl->cfg.verbose)
     {
       printf ("\nCLIENT (fd %d): Sending exit cfg to server...\n", ctrl->fd);
-      sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+      vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
     }
   (void) sock_test_write (ctrl->fd, (uint8_t *) & ctrl->cfg,
 			  sizeof (ctrl->cfg), &ctrl->stats,
@@ -579,8 +579,8 @@
 sock_test_connect_test_sockets (uint32_t num_test_sockets)
 {
   sock_client_main_t *scm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &scm->ctrl_socket;
-  sock_test_socket_t *tsock;
+  vcl_test_session_t *ctrl = &scm->ctrl_socket;
+  vcl_test_session_t *tsock;
   int i, rv, errno_val;
 
   if (num_test_sockets < 1)
@@ -607,7 +607,7 @@
   else if (num_test_sockets > scm->num_test_sockets)
     {
       tsock = realloc (scm->test_socket,
-		       sizeof (sock_test_socket_t) * num_test_sockets);
+		       sizeof (vcl_test_session_t) * num_test_sockets);
       if (!tsock)
 	{
 	  errno_val = errno;
@@ -669,7 +669,7 @@
 	      return -1;
 	    }
 	  tsock->cfg = ctrl->cfg;
-	  sock_test_socket_buf_alloc (tsock);
+	  vcl_test_session_buf_alloc (tsock);
 	  sock_test_cfg_sync (tsock);
 
 	  printf ("CLIENT (fd %d): Test socket %d connected.\n",
@@ -688,23 +688,23 @@
 #define INDENT "\n  "
 
   printf ("CLIENT: Test configuration commands:"
-	  INDENT SOCK_TEST_TOKEN_HELP
+	  INDENT VCL_TEST_TOKEN_HELP
 	  "\t\t\tDisplay help."
-	  INDENT SOCK_TEST_TOKEN_EXIT
+	  INDENT VCL_TEST_TOKEN_EXIT
 	  "\t\t\tExit test client & server."
-	  INDENT SOCK_TEST_TOKEN_SHOW_CFG
+	  INDENT VCL_TEST_TOKEN_SHOW_CFG
 	  "\t\t\tShow the current test cfg."
-	  INDENT SOCK_TEST_TOKEN_RUN_UNI
+	  INDENT VCL_TEST_TOKEN_RUN_UNI
 	  "\t\t\tRun the Uni-directional test."
-	  INDENT SOCK_TEST_TOKEN_RUN_BI
+	  INDENT VCL_TEST_TOKEN_RUN_BI
 	  "\t\t\tRun the Bi-directional test."
-	  INDENT SOCK_TEST_TOKEN_VERBOSE
+	  INDENT VCL_TEST_TOKEN_VERBOSE
 	  "\t\t\tToggle verbose setting."
-	  INDENT SOCK_TEST_TOKEN_RXBUF_SIZE
+	  INDENT VCL_TEST_TOKEN_RXBUF_SIZE
 	  "<rxbuf size>\tRx buffer size (bytes)."
-	  INDENT SOCK_TEST_TOKEN_TXBUF_SIZE
+	  INDENT VCL_TEST_TOKEN_TXBUF_SIZE
 	  "<txbuf size>\tTx buffer size (bytes)."
-	  INDENT SOCK_TEST_TOKEN_NUM_WRITES
+	  INDENT VCL_TEST_TOKEN_NUM_WRITES
 	  "<# of writes>\tNumber of txbuf writes to server." "\n");
 }
 
@@ -712,37 +712,37 @@
 cfg_txbuf_size_set (void)
 {
   sock_client_main_t *scm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &scm->ctrl_socket;
-  char *p = ctrl->txbuf + strlen (SOCK_TEST_TOKEN_TXBUF_SIZE);
+  vcl_test_session_t *ctrl = &scm->ctrl_socket;
+  char *p = ctrl->txbuf + strlen (VCL_TEST_TOKEN_TXBUF_SIZE);
   uint64_t txbuf_size = strtoull ((const char *) p, NULL, 10);
 
-  if (txbuf_size >= SOCK_TEST_CFG_BUF_SIZE_MIN)
+  if (txbuf_size >= VCL_TEST_CFG_BUF_SIZE_MIN)
     {
       ctrl->cfg.txbuf_size = txbuf_size;
       ctrl->cfg.total_bytes = ctrl->cfg.num_writes * ctrl->cfg.txbuf_size;
-      sock_test_buf_alloc (&ctrl->cfg, 0 /* is_rxbuf */ ,
-			   (uint8_t **) & ctrl->txbuf, &ctrl->txbuf_size);
-      sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+      vcl_test_buf_alloc (&ctrl->cfg, 0 /* is_rxbuf */ ,
+			  (uint8_t **) & ctrl->txbuf, &ctrl->txbuf_size);
+      vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
     }
   else
     fprintf (stderr, "CLIENT: ERROR: Invalid txbuf size (%lu) < "
 	     "minimum buf size (%u)!\n",
-	     txbuf_size, SOCK_TEST_CFG_BUF_SIZE_MIN);
+	     txbuf_size, VCL_TEST_CFG_BUF_SIZE_MIN);
 }
 
 static void
 cfg_num_writes_set (void)
 {
   sock_client_main_t *scm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &scm->ctrl_socket;
-  char *p = ctrl->txbuf + strlen (SOCK_TEST_TOKEN_NUM_WRITES);
+  vcl_test_session_t *ctrl = &scm->ctrl_socket;
+  char *p = ctrl->txbuf + strlen (VCL_TEST_TOKEN_NUM_WRITES);
   uint32_t num_writes = strtoul ((const char *) p, NULL, 10);
 
   if (num_writes > 0)
     {
       ctrl->cfg.num_writes = num_writes;
       ctrl->cfg.total_bytes = ctrl->cfg.num_writes * ctrl->cfg.txbuf_size;
-      sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+      vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
     }
   else
     {
@@ -754,23 +754,23 @@
 cfg_num_test_sockets_set (void)
 {
   sock_client_main_t *scm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &scm->ctrl_socket;
-  char *p = ctrl->txbuf + strlen (SOCK_TEST_TOKEN_NUM_TEST_SCKTS);
+  vcl_test_session_t *ctrl = &scm->ctrl_socket;
+  char *p = ctrl->txbuf + strlen (VCL_TEST_TOKEN_NUM_TEST_SESS);
   uint32_t num_test_sockets = strtoul ((const char *) p, NULL, 10);
 
   if ((num_test_sockets > 0) &&
-      (num_test_sockets <= SOCK_TEST_CFG_MAX_TEST_SCKTS))
+      (num_test_sockets <= VCL_TEST_CFG_MAX_TEST_SESS))
     {
-      ctrl->cfg.num_test_sockets = num_test_sockets;
+      ctrl->cfg.num_test_sessions = num_test_sockets;
       sock_test_connect_test_sockets (num_test_sockets);
 
-      sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+      vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
     }
   else
     {
       fprintf (stderr, "CLIENT: ERROR: invalid num test sockets: "
 	       "%u, (%d max)\n",
-	       num_test_sockets, SOCK_TEST_CFG_MAX_TEST_SCKTS);
+	       num_test_sockets, VCL_TEST_CFG_MAX_TEST_SESS);
     }
 }
 
@@ -778,83 +778,83 @@
 cfg_rxbuf_size_set (void)
 {
   sock_client_main_t *scm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &scm->ctrl_socket;
-  char *p = ctrl->txbuf + strlen (SOCK_TEST_TOKEN_RXBUF_SIZE);
+  vcl_test_session_t *ctrl = &scm->ctrl_socket;
+  char *p = ctrl->txbuf + strlen (VCL_TEST_TOKEN_RXBUF_SIZE);
   uint64_t rxbuf_size = strtoull ((const char *) p, NULL, 10);
 
-  if (rxbuf_size >= SOCK_TEST_CFG_BUF_SIZE_MIN)
+  if (rxbuf_size >= VCL_TEST_CFG_BUF_SIZE_MIN)
     {
       ctrl->cfg.rxbuf_size = rxbuf_size;
-      sock_test_buf_alloc (&ctrl->cfg, 1 /* is_rxbuf */ ,
-			   (uint8_t **) & ctrl->rxbuf, &ctrl->rxbuf_size);
-      sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+      vcl_test_buf_alloc (&ctrl->cfg, 1 /* is_rxbuf */ ,
+			  (uint8_t **) & ctrl->rxbuf, &ctrl->rxbuf_size);
+      vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
     }
   else
     fprintf (stderr, "CLIENT: ERROR: Invalid rxbuf size (%lu) < "
 	     "minimum buf size (%u)!\n",
-	     rxbuf_size, SOCK_TEST_CFG_BUF_SIZE_MIN);
+	     rxbuf_size, VCL_TEST_CFG_BUF_SIZE_MIN);
 }
 
 static void
 cfg_verbose_toggle (void)
 {
   sock_client_main_t *scm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &scm->ctrl_socket;
+  vcl_test_session_t *ctrl = &scm->ctrl_socket;
 
   ctrl->cfg.verbose = ctrl->cfg.verbose ? 0 : 1;
-  sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+  vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
 
 }
 
-static sock_test_t
+static vcl_test_t
 parse_input ()
 {
   sock_client_main_t *scm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &scm->ctrl_socket;
-  sock_test_t rv = SOCK_TEST_TYPE_NONE;
+  vcl_test_session_t *ctrl = &scm->ctrl_socket;
+  vcl_test_t rv = VCL_TEST_TYPE_NONE;
 
-  if (!strncmp (SOCK_TEST_TOKEN_EXIT, ctrl->txbuf,
-		strlen (SOCK_TEST_TOKEN_EXIT)))
-    rv = SOCK_TEST_TYPE_EXIT;
+  if (!strncmp (VCL_TEST_TOKEN_EXIT, ctrl->txbuf,
+		strlen (VCL_TEST_TOKEN_EXIT)))
+    rv = VCL_TEST_TYPE_EXIT;
 
-  else if (!strncmp (SOCK_TEST_TOKEN_HELP, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_HELP)))
+  else if (!strncmp (VCL_TEST_TOKEN_HELP, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_HELP)))
     dump_help ();
 
-  else if (!strncmp (SOCK_TEST_TOKEN_SHOW_CFG, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_SHOW_CFG)))
+  else if (!strncmp (VCL_TEST_TOKEN_SHOW_CFG, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_SHOW_CFG)))
     scm->dump_cfg = 1;
 
-  else if (!strncmp (SOCK_TEST_TOKEN_VERBOSE, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_VERBOSE)))
+  else if (!strncmp (VCL_TEST_TOKEN_VERBOSE, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_VERBOSE)))
     cfg_verbose_toggle ();
 
-  else if (!strncmp (SOCK_TEST_TOKEN_TXBUF_SIZE, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_TXBUF_SIZE)))
+  else if (!strncmp (VCL_TEST_TOKEN_TXBUF_SIZE, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_TXBUF_SIZE)))
     cfg_txbuf_size_set ();
 
-  else if (!strncmp (SOCK_TEST_TOKEN_NUM_TEST_SCKTS, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_NUM_TEST_SCKTS)))
+  else if (!strncmp (VCL_TEST_TOKEN_NUM_TEST_SESS, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_NUM_TEST_SESS)))
     cfg_num_test_sockets_set ();
 
-  else if (!strncmp (SOCK_TEST_TOKEN_NUM_WRITES, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_NUM_WRITES)))
+  else if (!strncmp (VCL_TEST_TOKEN_NUM_WRITES, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_NUM_WRITES)))
     cfg_num_writes_set ();
 
-  else if (!strncmp (SOCK_TEST_TOKEN_RXBUF_SIZE, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_RXBUF_SIZE)))
+  else if (!strncmp (VCL_TEST_TOKEN_RXBUF_SIZE, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_RXBUF_SIZE)))
     cfg_rxbuf_size_set ();
 
-  else if (!strncmp (SOCK_TEST_TOKEN_RUN_UNI, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_RUN_UNI)))
-    rv = ctrl->cfg.test = SOCK_TEST_TYPE_UNI;
+  else if (!strncmp (VCL_TEST_TOKEN_RUN_UNI, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_RUN_UNI)))
+    rv = ctrl->cfg.test = VCL_TEST_TYPE_UNI;
 
-  else if (!strncmp (SOCK_TEST_TOKEN_RUN_BI, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_RUN_BI)))
-    rv = ctrl->cfg.test = SOCK_TEST_TYPE_BI;
+  else if (!strncmp (VCL_TEST_TOKEN_RUN_BI, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_RUN_BI)))
+    rv = ctrl->cfg.test = VCL_TEST_TYPE_BI;
 
   else
-    rv = SOCK_TEST_TYPE_ECHO;
+    rv = VCL_TEST_TYPE_ECHO;
 
   return rv;
 }
@@ -885,12 +885,12 @@
 main (int argc, char **argv)
 {
   sock_client_main_t *scm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &scm->ctrl_socket;
+  vcl_test_session_t *ctrl = &scm->ctrl_socket;
   int c, rv, errno_val;
-  sock_test_t post_test = SOCK_TEST_TYPE_NONE;
+  vcl_test_t post_test = VCL_TEST_TYPE_NONE;
 
-  sock_test_cfg_init (&ctrl->cfg);
-  sock_test_socket_buf_alloc (ctrl);
+  vcl_test_cfg_init (&ctrl->cfg);
+  vcl_test_session_buf_alloc (ctrl);
 
   opterr = 0;
   while ((c = getopt (argc, argv, "chn:w:XE:I:N:R:T:UBV6D")) != -1)
@@ -901,20 +901,20 @@
 	break;
 
       case 's':
-	if (sscanf (optarg, "0x%x", &ctrl->cfg.num_test_sockets) != 1)
-	  if (sscanf (optarg, "%u", &ctrl->cfg.num_test_sockets) != 1)
+	if (sscanf (optarg, "0x%x", &ctrl->cfg.num_test_sessions) != 1)
+	  if (sscanf (optarg, "%u", &ctrl->cfg.num_test_sessions) != 1)
 	    {
 	      fprintf (stderr, "CLIENT: ERROR: Invalid value for "
 		       "option -%c!\n", c);
 	      print_usage_and_exit ();
 	    }
-	if (!ctrl->cfg.num_test_sockets ||
-	    (ctrl->cfg.num_test_sockets > FD_SETSIZE))
+	if (!ctrl->cfg.num_test_sessions ||
+	    (ctrl->cfg.num_test_sessions > FD_SETSIZE))
 	  {
 	    fprintf (stderr, "CLIENT: ERROR: Invalid number of "
 		     "sockets (%d) specified for option -%c!\n"
 		     "       Valid range is 1 - %d\n",
-		     ctrl->cfg.num_test_sockets, c, FD_SETSIZE);
+		     ctrl->cfg.num_test_sessions, c, FD_SETSIZE);
 	    print_usage_and_exit ();
 	  }
 	break;
@@ -924,7 +924,7 @@
 	break;
 
       case 'X':
-	post_test = SOCK_TEST_TYPE_EXIT;
+	post_test = VCL_TEST_TYPE_EXIT;
 	break;
 
       case 'E':
@@ -936,22 +936,21 @@
 	    print_usage_and_exit ();
 	  }
 	strcpy (ctrl->txbuf, optarg);
-	ctrl->cfg.test = SOCK_TEST_TYPE_ECHO;
+	ctrl->cfg.test = VCL_TEST_TYPE_ECHO;
 	break;
 
       case 'I':
-	if (sscanf (optarg, "0x%x", &ctrl->cfg.num_test_sockets) != 1)
-	  if (sscanf (optarg, "%d", &ctrl->cfg.num_test_sockets) != 1)
+	if (sscanf (optarg, "0x%x", &ctrl->cfg.num_test_sessions) != 1)
+	  if (sscanf (optarg, "%d", &ctrl->cfg.num_test_sessions) != 1)
 	    {
 	      fprintf (stderr, "CLIENT: ERROR: Invalid value for "
 		       "option -%c!\n", c);
 	      print_usage_and_exit ();
 	    }
-	if (ctrl->cfg.num_test_sockets > SOCK_TEST_CFG_MAX_TEST_SCKTS)
+	if (ctrl->cfg.num_test_sessions > VCL_TEST_CFG_MAX_TEST_SESS)
 	  {
 	    fprintf (stderr, "CLIENT: ERROR: value greater than max "
-		     "number test sockets (%d)!",
-		     SOCK_TEST_CFG_MAX_TEST_SCKTS);
+		     "number test sockets (%d)!", VCL_TEST_CFG_MAX_TEST_SESS);
 	    print_usage_and_exit ();
 	  }
 	break;
@@ -975,18 +974,18 @@
 		       "option -%c!\n", c);
 	      print_usage_and_exit ();
 	    }
-	if (ctrl->cfg.rxbuf_size >= SOCK_TEST_CFG_BUF_SIZE_MIN)
+	if (ctrl->cfg.rxbuf_size >= VCL_TEST_CFG_BUF_SIZE_MIN)
 	  {
 	    ctrl->rxbuf_size = ctrl->cfg.rxbuf_size;
-	    sock_test_buf_alloc (&ctrl->cfg, 1 /* is_rxbuf */ ,
-				 (uint8_t **) & ctrl->rxbuf,
-				 &ctrl->rxbuf_size);
+	    vcl_test_buf_alloc (&ctrl->cfg, 1 /* is_rxbuf */ ,
+				(uint8_t **) & ctrl->rxbuf,
+				&ctrl->rxbuf_size);
 	  }
 	else
 	  {
 	    fprintf (stderr, "CLIENT: ERROR: rxbuf size (%lu) "
 		     "less than minumum (%u)\n",
-		     ctrl->cfg.rxbuf_size, SOCK_TEST_CFG_BUF_SIZE_MIN);
+		     ctrl->cfg.rxbuf_size, VCL_TEST_CFG_BUF_SIZE_MIN);
 	    print_usage_and_exit ();
 	  }
 
@@ -1000,12 +999,12 @@
 		       "for option -%c!\n", c);
 	      print_usage_and_exit ();
 	    }
-	if (ctrl->cfg.txbuf_size >= SOCK_TEST_CFG_BUF_SIZE_MIN)
+	if (ctrl->cfg.txbuf_size >= VCL_TEST_CFG_BUF_SIZE_MIN)
 	  {
 	    ctrl->txbuf_size = ctrl->cfg.txbuf_size;
-	    sock_test_buf_alloc (&ctrl->cfg, 0 /* is_rxbuf */ ,
-				 (uint8_t **) & ctrl->txbuf,
-				 &ctrl->txbuf_size);
+	    vcl_test_buf_alloc (&ctrl->cfg, 0 /* is_rxbuf */ ,
+				(uint8_t **) & ctrl->txbuf,
+				&ctrl->txbuf_size);
 	    ctrl->cfg.total_bytes =
 	      ctrl->cfg.num_writes * ctrl->cfg.txbuf_size;
 	  }
@@ -1013,17 +1012,17 @@
 	  {
 	    fprintf (stderr, "CLIENT: ERROR: txbuf size (%lu) "
 		     "less than minumum (%u)!\n",
-		     ctrl->cfg.txbuf_size, SOCK_TEST_CFG_BUF_SIZE_MIN);
+		     ctrl->cfg.txbuf_size, VCL_TEST_CFG_BUF_SIZE_MIN);
 	    print_usage_and_exit ();
 	  }
 	break;
 
       case 'U':
-	ctrl->cfg.test = SOCK_TEST_TYPE_UNI;
+	ctrl->cfg.test = VCL_TEST_TYPE_UNI;
 	break;
 
       case 'B':
-	ctrl->cfg.test = SOCK_TEST_TYPE_BI;
+	ctrl->cfg.test = VCL_TEST_TYPE_BI;
 	break;
 
       case 'V':
@@ -1173,56 +1172,56 @@
     }
   while (rv < 0);
 
-  sock_test_connect_test_sockets (ctrl->cfg.num_test_sockets);
+  sock_test_connect_test_sockets (ctrl->cfg.num_test_sessions);
 
-  while (ctrl->cfg.test != SOCK_TEST_TYPE_EXIT)
+  while (ctrl->cfg.test != VCL_TEST_TYPE_EXIT)
     {
       if (scm->dump_cfg)
 	{
-	  sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+	  vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
 	  scm->dump_cfg = 0;
 	}
 
       switch (ctrl->cfg.test)
 	{
-	case SOCK_TEST_TYPE_ECHO:
+	case VCL_TEST_TYPE_ECHO:
 	  echo_test_client ();
 	  break;
 
-	case SOCK_TEST_TYPE_UNI:
-	case SOCK_TEST_TYPE_BI:
+	case VCL_TEST_TYPE_UNI:
+	case VCL_TEST_TYPE_BI:
 	  stream_test_client (ctrl->cfg.test);
 	  break;
 
-	case SOCK_TEST_TYPE_EXIT:
+	case VCL_TEST_TYPE_EXIT:
 	  continue;
 
-	case SOCK_TEST_TYPE_NONE:
+	case VCL_TEST_TYPE_NONE:
 	default:
 	  break;
 	}
       switch (post_test)
 	{
-	case SOCK_TEST_TYPE_EXIT:
+	case VCL_TEST_TYPE_EXIT:
 	  switch (ctrl->cfg.test)
 	    {
-	    case SOCK_TEST_TYPE_EXIT:
-	    case SOCK_TEST_TYPE_UNI:
-	    case SOCK_TEST_TYPE_BI:
-	    case SOCK_TEST_TYPE_ECHO:
-	      ctrl->cfg.test = SOCK_TEST_TYPE_EXIT;
+	    case VCL_TEST_TYPE_EXIT:
+	    case VCL_TEST_TYPE_UNI:
+	    case VCL_TEST_TYPE_BI:
+	    case VCL_TEST_TYPE_ECHO:
+	      ctrl->cfg.test = VCL_TEST_TYPE_EXIT;
 	      continue;
 
-	    case SOCK_TEST_TYPE_NONE:
+	    case VCL_TEST_TYPE_NONE:
 	    default:
 	      break;
 	    }
 	  break;
 
-	case SOCK_TEST_TYPE_NONE:
-	case SOCK_TEST_TYPE_ECHO:
-	case SOCK_TEST_TYPE_UNI:
-	case SOCK_TEST_TYPE_BI:
+	case VCL_TEST_TYPE_NONE:
+	case VCL_TEST_TYPE_ECHO:
+	case VCL_TEST_TYPE_UNI:
+	case VCL_TEST_TYPE_BI:
 	default:
 	  break;
 	}
@@ -1231,7 +1230,7 @@
       memset (ctrl->rxbuf, 0, ctrl->rxbuf_size);
 
       printf ("\nCLIENT: Type some characters and hit <return>\n"
-	      "('" SOCK_TEST_TOKEN_HELP "' for help): ");
+	      "('" VCL_TEST_TOKEN_HELP "' for help): ");
 
       if (fgets (ctrl->txbuf, ctrl->txbuf_size, stdin) != NULL)
 	{
diff --git a/src/vcl/sock_test_common.h b/src/vcl/sock_test_common.h
deleted file mode 100644
index 3355397..0000000
--- a/src/vcl/sock_test_common.h
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Copyright (c) 2018 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __sock_test_common_h__
-#define __sock_test_common_h__
-
-#include <netdb.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define SOCK_TEST_TOKEN_HELP           "#H"
-#define SOCK_TEST_TOKEN_EXIT           "#X"
-#define SOCK_TEST_TOKEN_VERBOSE        "#V"
-#define SOCK_TEST_TOKEN_TXBUF_SIZE     "#T:"
-#define SOCK_TEST_TOKEN_NUM_TEST_SCKTS "#I:"
-#define SOCK_TEST_TOKEN_NUM_WRITES     "#N:"
-#define SOCK_TEST_TOKEN_RXBUF_SIZE     "#R:"
-#define SOCK_TEST_TOKEN_SHOW_CFG       "#C"
-#define SOCK_TEST_TOKEN_RUN_UNI        "#U"
-#define SOCK_TEST_TOKEN_RUN_BI         "#B"
-
-#define SOCK_TEST_BANNER_STRING \
-  "============================================\n"
-#define SOCK_TEST_SEPARATOR_STRING \
-  "  -----------------------------\n"
-
-#define ONE_GIG                       (1024*1024*1024)
-#define SOCK_TEST_SERVER_PORT         22000
-#define SOCK_TEST_LOCALHOST_IPADDR    "127.0.0.1"
-
-#define SOCK_TEST_CFG_CTRL_MAGIC      0xfeedface
-#define SOCK_TEST_CFG_NUM_WRITES_DEF  1000000
-#define SOCK_TEST_CFG_TXBUF_SIZE_DEF  8192
-#define SOCK_TEST_CFG_RXBUF_SIZE_DEF  (64*SOCK_TEST_CFG_TXBUF_SIZE_DEF)
-#define SOCK_TEST_CFG_BUF_SIZE_MIN    128
-#define SOCK_TEST_CFG_MAX_TEST_SCKTS  32
-
-typedef enum
-{
-  SOCK_TEST_TYPE_NONE,
-  SOCK_TEST_TYPE_ECHO,
-  SOCK_TEST_TYPE_UNI,
-  SOCK_TEST_TYPE_BI,
-  SOCK_TEST_TYPE_EXIT,
-} sock_test_t;
-
-typedef struct  __attribute__ ((packed))
-{
-  uint32_t magic;
-  uint32_t seq_num;
-  uint32_t test;
-  uint32_t ctrl_handle;
-  uint32_t num_test_sockets;
-  uint32_t verbose;
-  uint32_t address_ip6;
-  uint32_t transport_udp;
-  uint64_t rxbuf_size;
-  uint64_t txbuf_size;
-  uint64_t num_writes;
-  uint64_t total_bytes;
-} sock_test_cfg_t;
-
-typedef struct
-{
-  uint64_t rx_xacts;
-  uint64_t rx_bytes;
-  uint32_t rx_eagain;
-  uint32_t rx_incomp;
-  uint64_t tx_xacts;
-  uint64_t tx_bytes;
-  uint32_t tx_eagain;
-  uint32_t tx_incomp;
-  struct timespec start;
-  struct timespec stop;
-} sock_test_stats_t;
-
-typedef struct
-{
-  int fd;
-  uint32_t txbuf_size;
-  char *txbuf;
-  uint32_t rxbuf_size;
-  char *rxbuf;
-  sock_test_cfg_t cfg;
-  sock_test_stats_t stats;
-} sock_test_socket_t;
-
-static inline void
-sock_test_stats_accumulate (sock_test_stats_t * accum,
-                            sock_test_stats_t * incr)
-{
-  accum->rx_xacts += incr->rx_xacts;
-  accum->rx_bytes += incr->rx_bytes;
-  accum->rx_eagain += incr->rx_eagain;
-  accum->rx_incomp += incr->rx_incomp;
-  accum->tx_xacts += incr->tx_xacts;
-  accum->tx_bytes += incr->tx_bytes;
-  accum->tx_eagain += incr->tx_eagain;
-  accum->tx_incomp += incr->tx_incomp;
-}
-
-static inline void
-sock_test_cfg_init (sock_test_cfg_t *cfg)
-{
-  cfg->magic = SOCK_TEST_CFG_CTRL_MAGIC;
-  cfg->test = SOCK_TEST_TYPE_NONE;
-  cfg->ctrl_handle = ~0;
-  cfg->num_test_sockets = 1;
-  cfg->verbose = 0;
-  cfg->rxbuf_size = SOCK_TEST_CFG_RXBUF_SIZE_DEF;
-  cfg->num_writes = SOCK_TEST_CFG_NUM_WRITES_DEF;
-  cfg->txbuf_size = SOCK_TEST_CFG_TXBUF_SIZE_DEF;
-  cfg->total_bytes = cfg->num_writes * cfg->txbuf_size;
-}
-
-static inline int
-sock_test_cfg_verify (sock_test_cfg_t *cfg, sock_test_cfg_t *valid_cfg)
-{
-  /* Note: txbuf & rxbuf on server are the same buffer,
-   *       so txbuf_size is not included in this check.
-   */
-  return ((cfg->magic == valid_cfg->magic)
-          && (cfg->test == valid_cfg->test)
-          && (cfg->verbose == valid_cfg->verbose)
-          && (cfg->rxbuf_size == valid_cfg->rxbuf_size)
-          && (cfg->num_writes == valid_cfg->num_writes)
-          && (cfg->total_bytes == valid_cfg->total_bytes));
-}
-
-static inline void
-sock_test_buf_alloc (sock_test_cfg_t *cfg, uint8_t is_rxbuf, uint8_t **buf,
-                     uint32_t *bufsize)
-{
-  uint32_t alloc_size = is_rxbuf ? cfg->rxbuf_size : cfg->txbuf_size;
-  uint8_t *lb = realloc (*buf, (size_t) alloc_size);
-
-  if (lb)
-    {
-      if (is_rxbuf)
-        cfg->rxbuf_size = *bufsize = alloc_size;
-      else
-        cfg->txbuf_size = *bufsize = alloc_size;
-      
-      *buf = lb;
-    }
-  else
-    {
-      int errno_val = errno;
-      perror ("ERROR in sock_test_buf_alloc()");
-      fprintf (stderr, "SOCK_TEST: ERROR: Buffer allocation "
-               "failed (errno = %d)!\n"
-               "       Using buffer size %d instead of desired"
-               " size (%d)\n", errno_val, *bufsize, alloc_size);
-    }
-}
-
-static inline void
-sock_test_socket_buf_alloc (sock_test_socket_t *socket)
-{
-  socket->rxbuf_size = socket->cfg.rxbuf_size;
-  socket->txbuf_size = socket->cfg.txbuf_size;
-  sock_test_buf_alloc (&socket->cfg, 0 /* is_rxbuf */ ,
-		       (uint8_t **) &socket->txbuf, &socket->txbuf_size);
-  sock_test_buf_alloc (&socket->cfg, 1 /* is_rxbuf */ ,
-		       (uint8_t **) &socket->rxbuf, &socket->rxbuf_size);
-}
-
-static inline char *
-sock_test_type_str (sock_test_t t)
-{
-  switch (t)
-    {
-    case SOCK_TEST_TYPE_NONE:
-      return "NONE";
-
-    case SOCK_TEST_TYPE_ECHO:
-      return "ECHO";
-
-    case SOCK_TEST_TYPE_UNI:
-      return "UNI";
-
-    case SOCK_TEST_TYPE_BI:
-      return "BI";
-
-    case SOCK_TEST_TYPE_EXIT:
-      return "EXIT";
-
-    default:
-      return "Unknown";
-    }
-}
-
-static inline void
-sock_test_cfg_dump (sock_test_cfg_t * cfg, uint8_t is_client)
-{
-  char *spc = "     ";
-  
-  printf ("  test config (%p):\n"
-          SOCK_TEST_SEPARATOR_STRING
-	  "                 magic:  0x%08x\n"
-	  "               seq_num:  0x%08x\n"
-	  "%-5s             test:  %s (%d)\n"
-	  "           ctrl handle:  %d (0x%x)\n"
-	  "%-5s num test sockets:  %u (0x%08x)\n"
-	  "%-5s          verbose:  %s (%d)\n"
-	  "%-5s       rxbuf size:  %lu (0x%08lx)\n"
-	  "%-5s       txbuf size:  %lu (0x%08lx)\n"
-	  "%-5s       num writes:  %lu (0x%08lx)\n"
-	  "       client tx bytes:  %lu (0x%08lx)\n"
-          SOCK_TEST_SEPARATOR_STRING,
-	  (void *) cfg, cfg->magic, cfg->seq_num,
-          is_client && (cfg->test == SOCK_TEST_TYPE_UNI) ?
-          "'"SOCK_TEST_TOKEN_RUN_UNI"'" :
-          is_client && (cfg->test == SOCK_TEST_TYPE_BI) ?
-           "'"SOCK_TEST_TOKEN_RUN_BI"'" : spc,
-          sock_test_type_str (cfg->test), cfg->test,
-          cfg->ctrl_handle, cfg->ctrl_handle,
-          is_client ? "'"SOCK_TEST_TOKEN_NUM_TEST_SCKTS"'" : spc,
-          cfg->num_test_sockets, cfg->num_test_sockets,
-          is_client ? "'"SOCK_TEST_TOKEN_VERBOSE"'" : spc,
-          cfg->verbose ? "on" : "off", cfg->verbose,
-          is_client ? "'"SOCK_TEST_TOKEN_RXBUF_SIZE"'" : spc,
-          cfg->rxbuf_size, cfg->rxbuf_size,
-          is_client ? "'"SOCK_TEST_TOKEN_TXBUF_SIZE"'" : spc,
-          cfg->txbuf_size, cfg->txbuf_size,
-          is_client ? "'"SOCK_TEST_TOKEN_NUM_WRITES"'" : spc,
-          cfg->num_writes, cfg->num_writes,
-          cfg->total_bytes, cfg->total_bytes);
-}
-
-static inline void
-sock_test_stats_dump (char * header, sock_test_stats_t * stats,
-                      uint8_t show_rx, uint8_t show_tx,
-                      uint8_t verbose)
-{
-  struct timespec diff;
-  double duration, rate;
-  uint64_t total_bytes;
-  
-  if ((stats->stop.tv_nsec - stats->start.tv_nsec) < 0)
-    {
-      diff.tv_sec = stats->stop.tv_sec - stats->start.tv_sec - 1;
-      diff.tv_nsec = stats->stop.tv_nsec - stats->start.tv_nsec + 1e9;
-    }
-  else
-    {
-      diff.tv_sec = stats->stop.tv_sec - stats->start.tv_sec;
-      diff.tv_nsec = stats->stop.tv_nsec - stats->start.tv_nsec;
-    }
-  duration = (double) diff.tv_sec + (1e-9 * diff.tv_nsec);
-
-  total_bytes = stats->tx_bytes + stats->rx_bytes;
-  rate = (double) total_bytes * 8 / duration / 1e9;
-  printf ("\n%s: Streamed %lu bytes\n"
-          "  in %lf seconds (%lf Gbps %s-duplex)!\n",
-              header, total_bytes, duration, rate,
-          (show_rx && show_tx) ? "full" : "half");
-
-  if (show_tx)
-    {
-      printf (SOCK_TEST_SEPARATOR_STRING
-              "  tx stats (0x%p):\n"
-              SOCK_TEST_SEPARATOR_STRING
-              "         writes:  %lu (0x%08lx)\n"
-              "       tx bytes:  %lu (0x%08lx)\n"
-              "      tx eagain:  %u (0x%08x)\n"
-              "  tx incomplete:  %u (0x%08x)\n",
-              (void *)stats, stats->tx_xacts, stats->tx_xacts,
-              stats->tx_bytes, stats->tx_bytes,
-              stats->tx_eagain, stats->tx_eagain,
-              stats->tx_incomp, stats->tx_incomp);
-    }
-  if (show_rx)
-    {
-      printf (SOCK_TEST_SEPARATOR_STRING
-              "  rx stats (0x%p):\n"
-              SOCK_TEST_SEPARATOR_STRING
-              "          reads:  %lu (0x%08lx)\n"
-              "       rx bytes:  %lu (0x%08lx)\n"
-              "      rx eagain:  %u (0x%08x)\n"
-              "  rx incomplete:  %u (0x%08x)\n",
-              (void *)stats, stats->rx_xacts, stats->rx_xacts,
-              stats->rx_bytes, stats->rx_bytes,
-              stats->rx_eagain, stats->rx_eagain,
-              stats->rx_incomp, stats->rx_incomp);
-    }
-  if (verbose)
-    printf ("   start.tv_sec:  %ld\n"
-            "  start.tv_nsec:  %ld\n"
-            "    stop.tv_sec:  %ld\n"
-            "   stop.tv_nsec:  %ld\n",
-            stats->start.tv_sec, stats->start.tv_nsec,
-            stats->stop.tv_sec, stats->stop.tv_nsec);
-            
-  printf (SOCK_TEST_SEPARATOR_STRING);
-}
-
-#endif /* __sock_test_common_h__ */
diff --git a/src/vcl/sock_test_server.c b/src/vcl/sock_test_server.c
index 896aeb0..11c667c 100644
--- a/src/vcl/sock_test_server.c
+++ b/src/vcl/sock_test_server.c
@@ -51,8 +51,8 @@
   int fd;
   uint8_t *buf;
   uint32_t buf_size;
-  sock_test_cfg_t cfg;
-  sock_test_stats_t stats;
+  vcl_test_cfg_t cfg;
+  vcl_test_stats_t stats;
 #ifdef VCL_TEST
   vppcom_endpt_t endpt;
   uint8_t ip[16];
@@ -144,9 +144,9 @@
 	{
 	  sock_server_conn_t *conn = &conn_pool[i];
 	  memset (conn, 0, sizeof (*conn));
-	  sock_test_cfg_init (&conn->cfg);
-	  sock_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */ ,
-			       &conn->buf, &conn->buf_size);
+	  vcl_test_cfg_init (&conn->cfg);
+	  vcl_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */ ,
+			      &conn->buf, &conn->buf_size);
 	  conn->cfg.txbuf_size = conn->cfg.rxbuf_size;
 	}
 
@@ -197,17 +197,17 @@
 }
 
 static inline void
-sync_config_and_reply (sock_server_conn_t * conn, sock_test_cfg_t * rx_cfg)
+sync_config_and_reply (sock_server_conn_t * conn, vcl_test_cfg_t * rx_cfg)
 {
   conn->cfg = *rx_cfg;
-  sock_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */ ,
-		       &conn->buf, &conn->buf_size);
+  vcl_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */ ,
+		      &conn->buf, &conn->buf_size);
   conn->cfg.txbuf_size = conn->cfg.rxbuf_size;
 
   if (conn->cfg.verbose)
     {
       printf ("\nSERVER (fd %d): Replying to cfg message!\n", conn->fd);
-      sock_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
+      vcl_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
     }
   (void) sock_test_write (conn->fd, (uint8_t *) & conn->cfg,
 			  sizeof (conn->cfg), NULL, conn->cfg.verbose);
@@ -215,11 +215,11 @@
 
 static void
 stream_test_server_start_stop (sock_server_conn_t * conn,
-			       sock_test_cfg_t * rx_cfg)
+			       vcl_test_cfg_t * rx_cfg)
 {
   sock_server_main_t *ssm = &sock_server_main;
   int client_fd = conn->fd;
-  sock_test_t test = rx_cfg->test;
+  vcl_test_t test = rx_cfg->test;
 
   if (rx_cfg->ctrl_handle == conn->fd)
     {
@@ -232,46 +232,46 @@
 
 	  if (tc->cfg.ctrl_handle == conn->fd)
 	    {
-	      sock_test_stats_accumulate (&conn->stats, &tc->stats);
+	      vcl_test_stats_accumulate (&conn->stats, &tc->stats);
 
 	      if (conn->cfg.verbose)
 		{
 		  static char buf[64];
 
 		  sprintf (buf, "SERVER (fd %d) RESULTS", tc->fd);
-		  sock_test_stats_dump (buf, &tc->stats, 1 /* show_rx */ ,
-					test == SOCK_TEST_TYPE_BI
-					/* show tx */ ,
-					conn->cfg.verbose);
+		  vcl_test_stats_dump (buf, &tc->stats, 1 /* show_rx */ ,
+				       test == VCL_TEST_TYPE_BI
+				       /* show tx */ ,
+				       conn->cfg.verbose);
 		}
 	    }
 	}
 
-      sock_test_stats_dump ("SERVER RESULTS", &conn->stats, 1 /* show_rx */ ,
-			    (test == SOCK_TEST_TYPE_BI) /* show_tx */ ,
-			    conn->cfg.verbose);
-      sock_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
+      vcl_test_stats_dump ("SERVER RESULTS", &conn->stats, 1 /* show_rx */ ,
+			   (test == VCL_TEST_TYPE_BI) /* show_tx */ ,
+			   conn->cfg.verbose);
+      vcl_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
       if (conn->cfg.verbose)
 	{
 	  printf ("  sock server main\n"
-		  SOCK_TEST_SEPARATOR_STRING
+		  VCL_TEST_SEPARATOR_STRING
 		  "       buf:  %p\n"
 		  "  buf size:  %u (0x%08x)\n"
-		  SOCK_TEST_SEPARATOR_STRING,
+		  VCL_TEST_SEPARATOR_STRING,
 		  conn->buf, conn->buf_size, conn->buf_size);
 	}
 
       sync_config_and_reply (conn, rx_cfg);
       printf ("\nSERVER (fd %d): %s-directional Stream Test Complete!\n"
 	      SOCK_TEST_BANNER_STRING "\n", conn->fd,
-	      test == SOCK_TEST_TYPE_BI ? "Bi" : "Uni");
+	      test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
     }
   else
     {
       printf ("\n" SOCK_TEST_BANNER_STRING
 	      "SERVER (fd %d): %s-directional Stream Test!\n"
 	      "  Sending client the test cfg to start streaming data...\n",
-	      client_fd, test == SOCK_TEST_TYPE_BI ? "Bi" : "Uni");
+	      client_fd, test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
 
       rx_cfg->ctrl_handle = (rx_cfg->ctrl_handle == ~0) ? conn->fd :
 	rx_cfg->ctrl_handle;
@@ -289,9 +289,9 @@
 stream_test_server (sock_server_conn_t * conn, int rx_bytes)
 {
   int client_fd = conn->fd;
-  sock_test_t test = conn->cfg.test;
+  vcl_test_t test = conn->cfg.test;
 
-  if (test == SOCK_TEST_TYPE_BI)
+  if (test == VCL_TEST_TYPE_BI)
     (void) sock_test_write (client_fd, conn->buf, rx_bytes, &conn->stats,
 			    conn->cfg.verbose);
 
@@ -461,13 +461,13 @@
   int client_fd, rv, main_rv = 0;
   int tx_bytes, rx_bytes, nbytes;
   sock_server_conn_t *conn;
-  sock_test_cfg_t *rx_cfg;
+  vcl_test_cfg_t *rx_cfg;
   uint32_t xtra = 0;
   uint64_t xtra_bytes = 0;
   struct sockaddr_storage servaddr;
   int errno_val;
   int c, v, i;
-  uint16_t port = SOCK_TEST_SERVER_PORT;
+  uint16_t port = VCL_TEST_SERVER_PORT;
 #if ! SOCK_SERVER_USE_EPOLL
   fd_set _rfdset, *rfdset = &_rfdset;
 #endif
@@ -834,14 +834,14 @@
 					 conn->buf_size, &conn->stats);
 	      if (rx_bytes > 0)
 		{
-		  rx_cfg = (sock_test_cfg_t *) conn->buf;
-		  if (rx_cfg->magic == SOCK_TEST_CFG_CTRL_MAGIC)
+		  rx_cfg = (vcl_test_cfg_t *) conn->buf;
+		  if (rx_cfg->magic == VCL_TEST_CFG_CTRL_MAGIC)
 		    {
 		      if (rx_cfg->verbose)
 			{
 			  printf ("SERVER (fd %d): Received a cfg message!\n",
 				  client_fd);
-			  sock_test_cfg_dump (rx_cfg, 0 /* is_client */ );
+			  vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
 			}
 
 		      if (rx_bytes != sizeof (*rx_cfg))
@@ -855,7 +855,7 @@
 			    {
 			      printf ("SERVER (fd %d): Replying to "
 				      "cfg message!\n", client_fd);
-			      sock_test_cfg_dump (rx_cfg, 0 /* is_client */ );
+			      vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
 			    }
 			  sock_test_write (client_fd, (uint8_t *) & conn->cfg,
 					   sizeof (conn->cfg), NULL,
@@ -865,17 +865,17 @@
 
 		      switch (rx_cfg->test)
 			{
-			case SOCK_TEST_TYPE_NONE:
-			case SOCK_TEST_TYPE_ECHO:
+			case VCL_TEST_TYPE_NONE:
+			case VCL_TEST_TYPE_ECHO:
 			  sync_config_and_reply (conn, rx_cfg);
 			  break;
 
-			case SOCK_TEST_TYPE_BI:
-			case SOCK_TEST_TYPE_UNI:
+			case VCL_TEST_TYPE_BI:
+			case VCL_TEST_TYPE_UNI:
 			  stream_test_server_start_stop (conn, rx_cfg);
 			  break;
 
-			case SOCK_TEST_TYPE_EXIT:
+			case VCL_TEST_TYPE_EXIT:
 			  printf ("SERVER: Have a great day, "
 				  "connection %d!\n", client_fd);
 #ifdef VCL_TEST
@@ -902,14 +902,14 @@
 			default:
 			  fprintf (stderr,
 				   "SERVER: ERROR: Unknown test type!\n");
-			  sock_test_cfg_dump (rx_cfg, 0 /* is_client */ );
+			  vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
 			  break;
 			}
 		      continue;
 		    }
 
-		  else if ((conn->cfg.test == SOCK_TEST_TYPE_UNI) ||
-			   (conn->cfg.test == SOCK_TEST_TYPE_BI))
+		  else if ((conn->cfg.test == VCL_TEST_TYPE_UNI) ||
+			   (conn->cfg.test == VCL_TEST_TYPE_BI))
 		    {
 		      stream_test_server (conn, rx_bytes);
 		      if (ioctl (conn->fd, FIONREAD))
diff --git a/src/vcl/vcl_test.h b/src/vcl/vcl_test.h
index 68750af..927110f 100644
--- a/src/vcl/vcl_test.h
+++ b/src/vcl/vcl_test.h
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <vcl/vppcom.h>
-#include <vcl/sock_test_common.h>
 
 #define vtfail(_fn, _rv)						\
 {									\
@@ -46,35 +45,330 @@
 #define vt_atomic_add(_ptr, _val) 					\
   __atomic_fetch_add (_ptr, _val, __ATOMIC_RELEASE)
 
+#define VCL_TEST_TOKEN_HELP           	"#H"
+#define VCL_TEST_TOKEN_EXIT           	"#X"
+#define VCL_TEST_TOKEN_VERBOSE        	"#V"
+#define VCL_TEST_TOKEN_TXBUF_SIZE     	"#T:"
+#define VCL_TEST_TOKEN_NUM_TEST_SESS 	"#I:"
+#define VCL_TEST_TOKEN_NUM_WRITES     	"#N:"
+#define VCL_TEST_TOKEN_RXBUF_SIZE     	"#R:"
+#define VCL_TEST_TOKEN_SHOW_CFG       	"#C"
+#define VCL_TEST_TOKEN_RUN_UNI        	"#U"
+#define VCL_TEST_TOKEN_RUN_BI         	"#B"
+
+#define VCL_TEST_SERVER_PORT         	22000
+#define VCL_TEST_LOCALHOST_IPADDR    	"127.0.0.1"
+
+#define VCL_TEST_CFG_CTRL_MAGIC      	0xfeedface
+#define VCL_TEST_CFG_NUM_WRITES_DEF  	1000000
+#define VCL_TEST_CFG_TXBUF_SIZE_DEF  	8192
+#define VCL_TEST_CFG_RXBUF_SIZE_DEF  	(64*VCL_TEST_CFG_TXBUF_SIZE_DEF)
+#define VCL_TEST_CFG_BUF_SIZE_MIN    	128
+#define VCL_TEST_CFG_MAX_TEST_SESS 	32
+#define VCL_TEST_CFG_MAX_EPOLL_EVENTS 	16
+
+#define VCL_TEST_DELAY_DISCONNECT	1
+#define VCL_TEST_SEPARATOR_STRING 	\
+  "  -----------------------------\n"
+typedef enum
+{
+  VCL_TEST_TYPE_NONE,
+  VCL_TEST_TYPE_ECHO,
+  VCL_TEST_TYPE_UNI,
+  VCL_TEST_TYPE_BI,
+  VCL_TEST_TYPE_EXIT,
+} vcl_test_t;
+
+typedef struct __attribute__ ((packed))
+{
+  uint32_t magic;
+  uint32_t seq_num;
+  uint32_t test;
+  uint32_t ctrl_handle;
+  uint32_t num_test_sessions;
+  uint32_t verbose;
+  uint32_t address_ip6;
+  uint32_t transport_udp;
+  uint64_t rxbuf_size;
+  uint64_t txbuf_size;
+  uint64_t num_writes;
+  uint64_t total_bytes;
+} vcl_test_cfg_t;
+
+typedef struct
+{
+  uint64_t rx_xacts;
+  uint64_t rx_bytes;
+  uint32_t rx_eagain;
+  uint32_t rx_incomp;
+  uint64_t tx_xacts;
+  uint64_t tx_bytes;
+  uint32_t tx_eagain;
+  uint32_t tx_incomp;
+  struct timespec start;
+  struct timespec stop;
+} vcl_test_stats_t;
+
+typedef struct
+{
+  int fd;
+  uint32_t txbuf_size;
+  char *txbuf;
+  uint32_t rxbuf_size;
+  char *rxbuf;
+  vcl_test_cfg_t cfg;
+  vcl_test_stats_t stats;
+} vcl_test_session_t;
+
+static inline void
+vcl_test_stats_accumulate (vcl_test_stats_t * accum, vcl_test_stats_t * incr)
+{
+  accum->rx_xacts += incr->rx_xacts;
+  accum->rx_bytes += incr->rx_bytes;
+  accum->rx_eagain += incr->rx_eagain;
+  accum->rx_incomp += incr->rx_incomp;
+  accum->tx_xacts += incr->tx_xacts;
+  accum->tx_bytes += incr->tx_bytes;
+  accum->tx_eagain += incr->tx_eagain;
+  accum->tx_incomp += incr->tx_incomp;
+}
+
+static inline void
+vcl_test_cfg_init (vcl_test_cfg_t * cfg)
+{
+  cfg->magic = VCL_TEST_CFG_CTRL_MAGIC;
+  cfg->test = VCL_TEST_TYPE_NONE;
+  cfg->ctrl_handle = ~0;
+  cfg->num_test_sessions = 1;
+  cfg->verbose = 0;
+  cfg->rxbuf_size = VCL_TEST_CFG_RXBUF_SIZE_DEF;
+  cfg->num_writes = VCL_TEST_CFG_NUM_WRITES_DEF;
+  cfg->txbuf_size = VCL_TEST_CFG_TXBUF_SIZE_DEF;
+  cfg->total_bytes = cfg->num_writes * cfg->txbuf_size;
+}
+
 static inline int
-vcl_test_read (int fd, uint8_t *buf, uint32_t nbytes,
-                sock_test_stats_t *stats)
+vcl_test_cfg_verify (vcl_test_cfg_t * cfg, vcl_test_cfg_t * valid_cfg)
+{
+  /* Note: txbuf & rxbuf on server are the same buffer,
+   *       so txbuf_size is not included in this check.
+   */
+  return ((cfg->magic == valid_cfg->magic)
+	  && (cfg->test == valid_cfg->test)
+	  && (cfg->verbose == valid_cfg->verbose)
+	  && (cfg->rxbuf_size == valid_cfg->rxbuf_size)
+	  && (cfg->num_writes == valid_cfg->num_writes)
+	  && (cfg->total_bytes == valid_cfg->total_bytes));
+}
+
+static inline void
+vcl_test_buf_alloc (vcl_test_cfg_t * cfg, uint8_t is_rxbuf, uint8_t ** buf,
+		    uint32_t * bufsize)
+{
+  uint32_t alloc_size = is_rxbuf ? cfg->rxbuf_size : cfg->txbuf_size;
+  uint8_t *lb = realloc (*buf, (size_t) alloc_size);
+
+  if (lb)
+    {
+      if (is_rxbuf)
+	cfg->rxbuf_size = *bufsize = alloc_size;
+      else
+	cfg->txbuf_size = *bufsize = alloc_size;
+
+      *buf = lb;
+    }
+  else
+    {
+      vtwrn ("realloc failed. using buffer size %d instead of %u",
+	     *bufsize, alloc_size);
+    }
+}
+
+static inline void
+vcl_test_session_buf_alloc (vcl_test_session_t * socket)
+{
+  socket->rxbuf_size = socket->cfg.rxbuf_size;
+  socket->txbuf_size = socket->cfg.txbuf_size;
+  vcl_test_buf_alloc (&socket->cfg, 0 /* is_rxbuf */ ,
+		      (uint8_t **) & socket->txbuf, &socket->txbuf_size);
+  vcl_test_buf_alloc (&socket->cfg, 1 /* is_rxbuf */ ,
+		      (uint8_t **) & socket->rxbuf, &socket->rxbuf_size);
+}
+
+static inline char *
+vcl_test_type_str (vcl_test_t t)
+{
+  switch (t)
+    {
+    case VCL_TEST_TYPE_NONE:
+      return "NONE";
+
+    case VCL_TEST_TYPE_ECHO:
+      return "ECHO";
+
+    case VCL_TEST_TYPE_UNI:
+      return "UNI";
+
+    case VCL_TEST_TYPE_BI:
+      return "BI";
+
+    case VCL_TEST_TYPE_EXIT:
+      return "EXIT";
+
+    default:
+      return "Unknown";
+    }
+}
+
+static inline void
+vcl_test_cfg_dump (vcl_test_cfg_t * cfg, uint8_t is_client)
+{
+  char *spc = "     ";
+
+  printf ("  test config (%p):\n"
+	  VCL_TEST_SEPARATOR_STRING
+	  "                 magic:  0x%08x\n"
+	  "               seq_num:  0x%08x\n"
+	  "%-5s             test:  %s (%d)\n"
+	  "           ctrl handle:  %d (0x%x)\n"
+	  "%-5s num test sockets:  %u (0x%08x)\n"
+	  "%-5s          verbose:  %s (%d)\n"
+	  "%-5s       rxbuf size:  %lu (0x%08lx)\n"
+	  "%-5s       txbuf size:  %lu (0x%08lx)\n"
+	  "%-5s       num writes:  %lu (0x%08lx)\n"
+	  "       client tx bytes:  %lu (0x%08lx)\n"
+	  VCL_TEST_SEPARATOR_STRING,
+	  (void *) cfg, cfg->magic, cfg->seq_num,
+	  is_client && (cfg->test == VCL_TEST_TYPE_UNI) ?
+	  "'" VCL_TEST_TOKEN_RUN_UNI "'" :
+	  is_client && (cfg->test == VCL_TEST_TYPE_BI) ?
+	  "'" VCL_TEST_TOKEN_RUN_BI "'" : spc,
+	  vcl_test_type_str (cfg->test), cfg->test,
+	  cfg->ctrl_handle, cfg->ctrl_handle,
+	  is_client ? "'" VCL_TEST_TOKEN_NUM_TEST_SESS "'" : spc,
+	  cfg->num_test_sessions, cfg->num_test_sessions,
+	  is_client ? "'" VCL_TEST_TOKEN_VERBOSE "'" : spc,
+	  cfg->verbose ? "on" : "off", cfg->verbose,
+	  is_client ? "'" VCL_TEST_TOKEN_RXBUF_SIZE "'" : spc,
+	  cfg->rxbuf_size, cfg->rxbuf_size,
+	  is_client ? "'" VCL_TEST_TOKEN_TXBUF_SIZE "'" : spc,
+	  cfg->txbuf_size, cfg->txbuf_size,
+	  is_client ? "'" VCL_TEST_TOKEN_NUM_WRITES "'" : spc,
+	  cfg->num_writes, cfg->num_writes,
+	  cfg->total_bytes, cfg->total_bytes);
+}
+
+static inline void
+vcl_test_stats_dump (char *header, vcl_test_stats_t * stats,
+		     uint8_t show_rx, uint8_t show_tx, uint8_t verbose)
+{
+  struct timespec diff;
+  double duration, rate;
+  uint64_t total_bytes;
+
+  if ((stats->stop.tv_nsec - stats->start.tv_nsec) < 0)
+    {
+      diff.tv_sec = stats->stop.tv_sec - stats->start.tv_sec - 1;
+      diff.tv_nsec = stats->stop.tv_nsec - stats->start.tv_nsec + 1e9;
+    }
+  else
+    {
+      diff.tv_sec = stats->stop.tv_sec - stats->start.tv_sec;
+      diff.tv_nsec = stats->stop.tv_nsec - stats->start.tv_nsec;
+    }
+  duration = (double) diff.tv_sec + (1e-9 * diff.tv_nsec);
+
+  total_bytes = stats->tx_bytes + stats->rx_bytes;
+  rate = (double) total_bytes *8 / duration / 1e9;
+  printf ("\n%s: Streamed %lu bytes\n"
+	  "  in %lf seconds (%lf Gbps %s-duplex)!\n",
+	  header, total_bytes, duration, rate,
+	  (show_rx && show_tx) ? "full" : "half");
+
+  if (show_tx)
+    {
+      printf (VCL_TEST_SEPARATOR_STRING
+	      "  tx stats (0x%p):\n"
+	      VCL_TEST_SEPARATOR_STRING
+	      "         writes:  %lu (0x%08lx)\n"
+	      "       tx bytes:  %lu (0x%08lx)\n"
+	      "      tx eagain:  %u (0x%08x)\n"
+	      "  tx incomplete:  %u (0x%08x)\n",
+	      (void *) stats, stats->tx_xacts, stats->tx_xacts,
+	      stats->tx_bytes, stats->tx_bytes,
+	      stats->tx_eagain, stats->tx_eagain,
+	      stats->tx_incomp, stats->tx_incomp);
+    }
+  if (show_rx)
+    {
+      printf (VCL_TEST_SEPARATOR_STRING
+	      "  rx stats (0x%p):\n"
+	      VCL_TEST_SEPARATOR_STRING
+	      "          reads:  %lu (0x%08lx)\n"
+	      "       rx bytes:  %lu (0x%08lx)\n"
+	      "      rx eagain:  %u (0x%08x)\n"
+	      "  rx incomplete:  %u (0x%08x)\n",
+	      (void *) stats, stats->rx_xacts, stats->rx_xacts,
+	      stats->rx_bytes, stats->rx_bytes,
+	      stats->rx_eagain, stats->rx_eagain,
+	      stats->rx_incomp, stats->rx_incomp);
+    }
+  if (verbose)
+    printf ("   start.tv_sec:  %ld\n"
+	    "  start.tv_nsec:  %ld\n"
+	    "    stop.tv_sec:  %ld\n"
+	    "   stop.tv_nsec:  %ld\n",
+	    stats->start.tv_sec, stats->start.tv_nsec,
+	    stats->stop.tv_sec, stats->stop.tv_nsec);
+
+  printf (VCL_TEST_SEPARATOR_STRING);
+}
+
+static inline int
+vcl_comp_tspec (struct timespec *a, struct timespec *b)
+{
+  if (a->tv_sec < b->tv_sec)
+    return -1;
+  else if (a->tv_sec > b->tv_sec)
+    return 1;
+  else if (a->tv_nsec < b->tv_nsec)
+    return -1;
+  else if (a->tv_nsec > b->tv_nsec)
+    return 1;
+  else
+    return 0;
+}
+
+static inline int
+vcl_test_read (int fd, uint8_t * buf, uint32_t nbytes,
+	       vcl_test_stats_t * stats)
 {
   int rx_bytes, errno_val;
-  
+
   do
     {
       if (stats)
-        stats->rx_xacts++;
+	stats->rx_xacts++;
       rx_bytes = vppcom_session_read (fd, buf, nbytes);
 
       if (rx_bytes < 0)
-        {
-          errno = -rx_bytes;
-          rx_bytes = -1;
-        }
+	{
+	  errno = -rx_bytes;
+	  rx_bytes = -1;
+	}
       if (stats)
-        {
-          if ((rx_bytes == 0) ||
-              ((rx_bytes < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))))
-            stats->rx_eagain++;
-          else if (rx_bytes < nbytes)
-            stats->rx_incomp++;
-        }
+	{
+	  if ((rx_bytes == 0) ||
+	      ((rx_bytes < 0)
+	       && ((errno == EAGAIN) || (errno == EWOULDBLOCK))))
+	    stats->rx_eagain++;
+	  else if (rx_bytes < nbytes)
+	    stats->rx_incomp++;
+	}
     }
   while ((rx_bytes == 0) ||
-         ((rx_bytes < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))));
-  
+	 ((rx_bytes < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))));
+
   if (rx_bytes < 0)
     {
       vterr ("vppcom_session_read()", -errno);
@@ -86,30 +380,31 @@
 }
 
 static inline int
-vcl_test_read_ds (int fd, vppcom_data_segments_t ds, sock_test_stats_t *stats)
+vcl_test_read_ds (int fd, vppcom_data_segments_t ds, vcl_test_stats_t * stats)
 {
   int rx_bytes, errno_val;
 
   do
     {
       if (stats)
-        stats->rx_xacts++;
+	stats->rx_xacts++;
       rx_bytes = vppcom_session_read_segments (fd, ds);
 
       if (rx_bytes < 0)
-        {
-          errno = -rx_bytes;
-          rx_bytes = -1;
-        }
+	{
+	  errno = -rx_bytes;
+	  rx_bytes = -1;
+	}
       if (stats)
-        {
-          if ((rx_bytes == 0) ||
-              ((rx_bytes < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))))
-            stats->rx_eagain++;
-        }
+	{
+	  if ((rx_bytes == 0) ||
+	      ((rx_bytes < 0)
+	       && ((errno == EAGAIN) || (errno == EWOULDBLOCK))))
+	    stats->rx_eagain++;
+	}
     }
   while ((rx_bytes == 0) ||
-         ((rx_bytes < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))));
+	 ((rx_bytes < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))));
 
   if (rx_bytes < 0)
     {
@@ -122,42 +417,43 @@
 }
 
 static inline int
-vcl_test_write (int fd, uint8_t *buf, uint32_t nbytes,
-                 sock_test_stats_t *stats, uint32_t verbose)
+vcl_test_write (int fd, uint8_t * buf, uint32_t nbytes,
+		vcl_test_stats_t * stats, uint32_t verbose)
 {
   int tx_bytes = 0, nbytes_left = nbytes, rv;
 
   do
     {
       if (stats)
-        stats->tx_xacts++;
+	stats->tx_xacts++;
       rv = vppcom_session_write (fd, buf, nbytes_left);
       if (rv < 0)
-        {
-          errno = -rv;
-          rv = -1;
-        }
+	{
+	  errno = -rv;
+	  rv = -1;
+	}
       if (rv < 0)
-        {
-          if ((errno == EAGAIN) || (errno == EWOULDBLOCK))
-            {
-              if (stats)
-                stats->tx_eagain++;
-              continue;
-            }
-          else
-            break;
-        }
+	{
+	  if ((errno == EAGAIN) || (errno == EWOULDBLOCK))
+	    {
+	      if (stats)
+		stats->tx_eagain++;
+	      continue;
+	    }
+	  else
+	    break;
+	}
       tx_bytes += rv;
-     
+
       if (tx_bytes != nbytes)
-        {
-          nbytes_left = nbytes_left - rv;
-          if (stats)
-            stats->tx_incomp++;
-        }
-     
-    } while (tx_bytes != nbytes);
+	{
+	  nbytes_left = nbytes_left - rv;
+	  if (stats)
+	    stats->tx_incomp++;
+	}
+
+    }
+  while (tx_bytes != nbytes);
 
   if (tx_bytes < 0)
     {
@@ -165,8 +461,16 @@
     }
   else if (stats)
     stats->tx_bytes += tx_bytes;
-  
+
   return (tx_bytes);
 }
 
 #endif /* __vcl_test_h__ */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vcl/vcl_test_client.c b/src/vcl/vcl_test_client.c
index cd92ed8..59286ee 100644
--- a/src/vcl/vcl_test_client.c
+++ b/src/vcl/vcl_test_client.c
@@ -27,14 +27,14 @@
 
 typedef struct
 {
-  sock_test_socket_t *sessions;
+  vcl_test_session_t *sessions;
   uint32_t n_sessions;
   uint32_t wrk_index;
   fd_set wr_fdset;
   fd_set rd_fdset;
   int max_fd_index;
   pthread_t thread_handle;
-  sock_test_cfg_t cfg;
+  vcl_test_cfg_t cfg;
 } vcl_test_client_worker_t;
 
 typedef struct
@@ -42,10 +42,10 @@
   vcl_test_client_worker_t *workers;
   vppcom_endpt_t server_endpt;
   uint32_t cfg_seq_num;
-  sock_test_socket_t ctrl_socket;
-  sock_test_socket_t *sessions;
+  vcl_test_session_t ctrl_session;
+  vcl_test_session_t *sessions;
   uint8_t dump_cfg;
-  sock_test_t post_test;
+  vcl_test_t post_test;
   uint32_t proto;
   uint32_t n_workers;
   volatile int active_workers;
@@ -60,57 +60,57 @@
 #define vtc_max(a, b) (a > b ? a : b)
 
 static int
-vtc_cfg_sync (sock_test_socket_t * sock)
+vtc_cfg_sync (vcl_test_session_t * ts)
 {
   vcl_test_client_main_t *vcm = &vcl_client_main;
-  sock_test_cfg_t *rx_cfg = (sock_test_cfg_t *) sock->rxbuf;
+  vcl_test_cfg_t *rx_cfg = (vcl_test_cfg_t *) ts->rxbuf;
   int rx_bytes, tx_bytes;
 
-  vt_atomic_add (&sock->cfg.seq_num, 1);
-  if (sock->cfg.verbose)
+  vt_atomic_add (&ts->cfg.seq_num, 1);
+  if (ts->cfg.verbose)
     {
-      vtinf ("(fd %d): Sending config to server.", sock->fd);
-      sock_test_cfg_dump (&sock->cfg, 1 /* is_client */ );
+      vtinf ("(fd %d): Sending config to server.", ts->fd);
+      vcl_test_cfg_dump (&ts->cfg, 1 /* is_client */ );
     }
-  tx_bytes = vcl_test_write (sock->fd, (uint8_t *) & sock->cfg,
-			     sizeof (sock->cfg), NULL, sock->cfg.verbose);
+  tx_bytes = vcl_test_write (ts->fd, (uint8_t *) & ts->cfg,
+			     sizeof (ts->cfg), NULL, ts->cfg.verbose);
   if (tx_bytes < 0)
     {
-      vtwrn ("(fd %d): write test cfg failed (%d)!", sock->fd, tx_bytes);
+      vtwrn ("(fd %d): write test cfg failed (%d)!", ts->fd, tx_bytes);
       return tx_bytes;
     }
 
-  rx_bytes = vcl_test_read (sock->fd, (uint8_t *) sock->rxbuf,
-			    sizeof (sock_test_cfg_t), NULL);
+  rx_bytes = vcl_test_read (ts->fd, (uint8_t *) ts->rxbuf,
+			    sizeof (vcl_test_cfg_t), NULL);
   if (rx_bytes < 0)
     return rx_bytes;
 
-  if (rx_cfg->magic != SOCK_TEST_CFG_CTRL_MAGIC)
+  if (rx_cfg->magic != VCL_TEST_CFG_CTRL_MAGIC)
     {
-      vtwrn ("(fd %d): Bad server reply cfg -- aborting!", sock->fd);
+      vtwrn ("(fd %d): Bad server reply cfg -- aborting!", ts->fd);
       return -1;
     }
-  if ((rx_bytes != sizeof (sock_test_cfg_t))
-      || !sock_test_cfg_verify (rx_cfg, &sock->cfg))
+  if ((rx_bytes != sizeof (vcl_test_cfg_t))
+      || !vcl_test_cfg_verify (rx_cfg, &ts->cfg))
     {
-      vtwrn ("(fd %d): Invalid config received from server!", sock->fd);
-      if (rx_bytes != sizeof (sock_test_cfg_t))
+      vtwrn ("(fd %d): Invalid config received from server!", ts->fd);
+      if (rx_bytes != sizeof (vcl_test_cfg_t))
 	{
 	  vtinf ("\tRx bytes %d != cfg size %lu", rx_bytes,
-		 sizeof (sock_test_cfg_t));
+		 sizeof (vcl_test_cfg_t));
 	}
       else
 	{
-	  sock_test_cfg_dump (rx_cfg, 1 /* is_client */ );
-	  vtinf ("(fd %d): Valid config sent to server.", sock->fd);
-	  sock_test_cfg_dump (&sock->cfg, 1 /* is_client */ );
+	  vcl_test_cfg_dump (rx_cfg, 1 /* is_client */ );
+	  vtinf ("(fd %d): Valid config sent to server.", ts->fd);
+	  vcl_test_cfg_dump (&ts->cfg, 1 /* is_client */ );
 	}
       return -1;
     }
-  if (sock->cfg.verbose)
+  if (ts->cfg.verbose)
     {
-      vtinf ("(fd %d): Got config back from server.", sock->fd);
-      sock_test_cfg_dump (rx_cfg, 1 /* is_client */ );
+      vtinf ("(fd %d): Got config back from server.", ts->fd);
+      vcl_test_cfg_dump (rx_cfg, 1 /* is_client */ );
     }
 
   return 0;
@@ -120,11 +120,11 @@
 vtc_connect_test_sessions (vcl_test_client_worker_t * wrk)
 {
   vcl_test_client_main_t *vcm = &vcl_client_main;
-  sock_test_socket_t *tsock;
+  vcl_test_session_t *ts;
   uint32_t n_test_sessions;
   int i, rv;
 
-  n_test_sessions = wrk->cfg.num_test_sockets;
+  n_test_sessions = wrk->cfg.num_test_sessions;
   if (n_test_sessions < 1)
     {
       errno = EINVAL;
@@ -136,9 +136,9 @@
 
   if (wrk->n_sessions)
     wrk->sessions = realloc (wrk->sessions,
-			     n_test_sessions * sizeof (sock_test_socket_t));
+			     n_test_sessions * sizeof (vcl_test_session_t));
   else
-    wrk->sessions = calloc (n_test_sessions, sizeof (sock_test_socket_t));
+    wrk->sessions = calloc (n_test_sessions, sizeof (vcl_test_session_t));
 
   if (!wrk->sessions)
     {
@@ -148,21 +148,21 @@
 
   for (i = 0; i < n_test_sessions; i++)
     {
-      tsock = &wrk->sessions[i];
-      tsock->fd = vppcom_session_create (vcm->proto, 1 /* is_nonblocking */ );
-      if (tsock->fd < 0)
+      ts = &wrk->sessions[i];
+      ts->fd = vppcom_session_create (vcm->proto, 1 /* is_nonblocking */ );
+      if (ts->fd < 0)
 	{
-	  vterr ("vppcom_session_create()", tsock->fd);
-	  return tsock->fd;
+	  vterr ("vppcom_session_create()", ts->fd);
+	  return ts->fd;
 	}
 
-      rv = vppcom_session_connect (tsock->fd, &vcm->server_endpt);
+      rv = vppcom_session_connect (ts->fd, &vcm->server_endpt);
       if (rv < 0)
 	{
 	  vterr ("vppcom_session_connect()", rv);
 	  return rv;
 	}
-      vtinf ("(fd %d): Test socket %d connected.", tsock->fd, i);
+      vtinf ("Test session %d (fd %d) connected.", i, ts->fd);
     }
   wrk->n_sessions = n_test_sessions;
 
@@ -175,36 +175,36 @@
 vtc_worker_test_setup (vcl_test_client_worker_t * wrk)
 {
   vcl_test_client_main_t *vcm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
-  sock_test_cfg_t *cfg = &wrk->cfg;
-  sock_test_socket_t *tsock;
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
+  vcl_test_cfg_t *cfg = &wrk->cfg;
+  vcl_test_session_t *ts;
   uint32_t sidx;
   int i, j;
 
   FD_ZERO (&wrk->wr_fdset);
   FD_ZERO (&wrk->rd_fdset);
 
-  for (i = 0; i < cfg->num_test_sockets; i++)
+  for (i = 0; i < cfg->num_test_sessions; i++)
     {
-      tsock = &wrk->sessions[i];
-      tsock->cfg = wrk->cfg;
-      sock_test_socket_buf_alloc (tsock);
+      ts = &wrk->sessions[i];
+      ts->cfg = wrk->cfg;
+      vcl_test_session_buf_alloc (ts);
 
       switch (cfg->test)
 	{
-	case SOCK_TEST_TYPE_ECHO:
-	  memcpy (tsock->txbuf, ctrl->txbuf, cfg->total_bytes);
+	case VCL_TEST_TYPE_ECHO:
+	  memcpy (ts->txbuf, ctrl->txbuf, cfg->total_bytes);
 	  break;
-	case SOCK_TEST_TYPE_UNI:
-	case SOCK_TEST_TYPE_BI:
-	  for (j = 0; j < tsock->txbuf_size; j++)
-	    tsock->txbuf[j] = j & 0xff;
+	case VCL_TEST_TYPE_UNI:
+	case VCL_TEST_TYPE_BI:
+	  for (j = 0; j < ts->txbuf_size; j++)
+	    ts->txbuf[j] = j & 0xff;
 	  break;
 	}
 
-      FD_SET (vppcom_session_index (tsock->fd), &wrk->wr_fdset);
-      FD_SET (vppcom_session_index (tsock->fd), &wrk->rd_fdset);
-      sidx = vppcom_session_index (tsock->fd);
+      FD_SET (vppcom_session_index (ts->fd), &wrk->wr_fdset);
+      FD_SET (vppcom_session_index (ts->fd), &wrk->rd_fdset);
+      sidx = vppcom_session_index (ts->fd);
       wrk->max_fd_index = vtc_max (sidx, wrk->max_fd_index);
     }
   wrk->max_fd_index += 1;
@@ -216,15 +216,15 @@
 vtc_worker_init (vcl_test_client_worker_t * wrk)
 {
   vcl_test_client_main_t *vcm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
-  sock_test_cfg_t *cfg = &wrk->cfg;
-  sock_test_socket_t *tsock;
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
+  vcl_test_cfg_t *cfg = &wrk->cfg;
+  vcl_test_session_t *ts;
   uint32_t i, n;
   int rv, nbytes;
 
   __wrk_index = wrk->wrk_index;
 
-  vtinf ("Initializing worker ...");
+  vtinf ("Initializing worker %u ...", wrk->wrk_index);
 
   if (wrk->wrk_index)
     {
@@ -238,7 +238,7 @@
   rv = vtc_connect_test_sessions (wrk);
   if (rv)
     {
-      vterr ("vtc_connect_test_sockets ()", rv);
+      vterr ("vtc_connect_test_sessions ()", rv);
       return rv;
     }
 
@@ -247,12 +247,12 @@
 
   vtinf ("Sending config to server on all sessions ...");
 
-  for (n = 0; n < cfg->num_test_sockets; n++)
+  for (n = 0; n < cfg->num_test_sessions; n++)
     {
-      tsock = &wrk->sessions[n];
-      if (vtc_cfg_sync (tsock))
+      ts = &wrk->sessions[n];
+      if (vtc_cfg_sync (ts))
 	return -1;
-      memset (&tsock->stats, 0, sizeof (tsock->stats));
+      memset (&ts->stats, 0, sizeof (ts->stats));
     }
 
   return 0;
@@ -262,32 +262,34 @@
 
 static void
 vtc_accumulate_stats (vcl_test_client_worker_t * wrk,
-		      sock_test_socket_t * ctrl)
+		      vcl_test_session_t * ctrl)
 {
-  sock_test_socket_t *tsock;
+  vcl_test_session_t *ts;
   static char buf[64];
   int i, show_rx = 0;
 
   while (__sync_lock_test_and_set (&stats_lock, 1))
     ;
 
-  if (ctrl->cfg.test == SOCK_TEST_TYPE_BI
-      || ctrl->cfg.test == SOCK_TEST_TYPE_ECHO)
+  if (ctrl->cfg.test == VCL_TEST_TYPE_BI
+      || ctrl->cfg.test == VCL_TEST_TYPE_ECHO)
     show_rx = 1;
 
-  for (i = 0; i < wrk->cfg.num_test_sockets; i++)
+  for (i = 0; i < wrk->cfg.num_test_sessions; i++)
     {
-      tsock = &wrk->sessions[i];
-      tsock->stats.start = ctrl->stats.start;
+      ts = &wrk->sessions[i];
+      ts->stats.start = ctrl->stats.start;
 
       if (ctrl->cfg.verbose > 1)
 	{
-	  sprintf (buf, "CLIENT (fd %d) RESULTS", tsock->fd);
-	  sock_test_stats_dump (buf, &tsock->stats, show_rx, 1 /* show tx */ ,
-				ctrl->cfg.verbose);
+	  sprintf (buf, "CLIENT (fd %d) RESULTS", ts->fd);
+	  vcl_test_stats_dump (buf, &ts->stats, show_rx, 1 /* show tx */ ,
+			       ctrl->cfg.verbose);
 	}
 
-      sock_test_stats_accumulate (&ctrl->stats, &tsock->stats);
+      vcl_test_stats_accumulate (&ctrl->stats, &ts->stats);
+      if (vcl_comp_tspec (&ctrl->stats.stop, &ts->stats.stop) < 0)
+	ctrl->stats.stop = ts->stats.stop;
     }
 
   __sync_lock_release (&stats_lock);
@@ -297,22 +299,22 @@
 vtc_worker_sessions_exit (vcl_test_client_worker_t * wrk)
 {
   vcl_test_client_main_t *vcm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
-  sock_test_socket_t *tsock;
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
+  vcl_test_session_t *ts;
   int i, verbose = ctrl->cfg.verbose;
 
-  for (i = 0; i < wrk->cfg.num_test_sockets; i++)
+  for (i = 0; i < wrk->cfg.num_test_sessions; i++)
     {
-      tsock = &wrk->sessions[i];
-      tsock->cfg.test = SOCK_TEST_TYPE_EXIT;
+      ts = &wrk->sessions[i];
+      ts->cfg.test = VCL_TEST_TYPE_EXIT;
 
       if (verbose)
 	{
-	  vtinf ("(fd %d): Sending exit cfg to server...", tsock->fd);
-	  sock_test_cfg_dump (&tsock->cfg, 1 /* is_client */ );
+	  vtinf ("(fd %d): Sending exit cfg to server...", ts->fd);
+	  vcl_test_cfg_dump (&ts->cfg, 1 /* is_client */ );
 	}
-      (void) vcl_test_write (tsock->fd, (uint8_t *) & tsock->cfg,
-			     sizeof (tsock->cfg), &tsock->stats, verbose);
+      (void) vcl_test_write (ts->fd, (uint8_t *) & ts->cfg,
+			     sizeof (ts->cfg), &ts->stats, verbose);
     }
   wrk->n_sessions = 0;
 }
@@ -321,12 +323,12 @@
 vtc_worker_loop (void *arg)
 {
   vcl_test_client_main_t *vcm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
   vcl_test_client_worker_t *wrk = arg;
   uint32_t n_active_sessions, n_bytes;
   fd_set _wfdset, *wfdset = &_wfdset;
   fd_set _rfdset, *rfdset = &_rfdset;
-  sock_test_socket_t *tsock;
+  vcl_test_session_t *ts;
   int i, rv, check_rx = 0;
 
   rv = vtc_worker_init (wrk);
@@ -341,8 +343,8 @@
   if (wrk->wrk_index == 0)
     clock_gettime (CLOCK_REALTIME, &ctrl->stats.start);
 
-  check_rx = wrk->cfg.test != SOCK_TEST_TYPE_UNI;
-  n_active_sessions = wrk->cfg.num_test_sockets;
+  check_rx = wrk->cfg.test != VCL_TEST_TYPE_UNI;
+  n_active_sessions = wrk->cfg.num_test_sessions;
   while (n_active_sessions)
     {
       _wfdset = wrk->wr_fdset;
@@ -358,51 +360,49 @@
       else if (rv == 0)
 	continue;
 
-      for (i = 0; i < wrk->cfg.num_test_sockets; i++)
+      for (i = 0; i < wrk->cfg.num_test_sessions; i++)
 	{
-	  tsock = &wrk->sessions[i];
-	  if (!((tsock->stats.stop.tv_sec == 0) &&
-		(tsock->stats.stop.tv_nsec == 0)))
+	  ts = &wrk->sessions[i];
+	  if (!((ts->stats.stop.tv_sec == 0) &&
+		(ts->stats.stop.tv_nsec == 0)))
 	    continue;
 
-	  if (FD_ISSET (vppcom_session_index (tsock->fd), rfdset)
-	      && tsock->stats.rx_bytes < tsock->cfg.total_bytes)
+	  if (FD_ISSET (vppcom_session_index (ts->fd), rfdset)
+	      && ts->stats.rx_bytes < ts->cfg.total_bytes)
 	    {
-	      (void) vcl_test_read (tsock->fd, (uint8_t *) tsock->rxbuf,
-				    tsock->rxbuf_size, &tsock->stats);
+	      (void) vcl_test_read (ts->fd, (uint8_t *) ts->rxbuf,
+				    ts->rxbuf_size, &ts->stats);
 	    }
 
-	  if (FD_ISSET (vppcom_session_index (tsock->fd), wfdset)
-	      && tsock->stats.tx_bytes < tsock->cfg.total_bytes)
+	  if (FD_ISSET (vppcom_session_index (ts->fd), wfdset)
+	      && ts->stats.tx_bytes < ts->cfg.total_bytes)
 	    {
-	      n_bytes = tsock->cfg.txbuf_size;
-	      if (tsock->cfg.test == SOCK_TEST_TYPE_ECHO)
+	      n_bytes = ts->cfg.txbuf_size;
+	      if (ts->cfg.test == VCL_TEST_TYPE_ECHO)
 		n_bytes = strlen (ctrl->txbuf) + 1;
-	      rv = vcl_test_write (tsock->fd, (uint8_t *) tsock->txbuf,
-				   n_bytes, &tsock->stats,
-				   tsock->cfg.verbose);
+	      rv = vcl_test_write (ts->fd, (uint8_t *) ts->txbuf,
+				   n_bytes, &ts->stats, ts->cfg.verbose);
 	      if (rv < 0)
 		{
 		  vtwrn ("vppcom_test_write (%d) failed -- aborting test",
-			 tsock->fd);
+			 ts->fd);
 		  goto exit;
 		}
 	    }
 
-	  if ((!check_rx && tsock->stats.tx_bytes >= tsock->cfg.total_bytes)
-	      || (check_rx
-		  && tsock->stats.rx_bytes >= tsock->cfg.total_bytes))
+	  if ((!check_rx && ts->stats.tx_bytes >= ts->cfg.total_bytes)
+	      || (check_rx && ts->stats.rx_bytes >= ts->cfg.total_bytes))
 	    {
-	      clock_gettime (CLOCK_REALTIME, &tsock->stats.stop);
+	      clock_gettime (CLOCK_REALTIME, &ts->stats.stop);
 	      n_active_sessions--;
 	    }
 	}
     }
 exit:
   vtinf ("Worker %d done ...", wrk->wrk_index);
-  if (wrk->cfg.test != SOCK_TEST_TYPE_ECHO)
+  if (wrk->cfg.test != VCL_TEST_TYPE_ECHO)
     vtc_accumulate_stats (wrk, ctrl);
-  sleep (1);
+  sleep (VCL_TEST_DELAY_DISCONNECT);
   vtc_worker_sessions_exit (wrk);
   if (wrk->wrk_index)
     vt_atomic_add (&vcm->active_workers, -1);
@@ -410,31 +410,31 @@
 }
 
 static void
-vtc_print_stats (sock_test_socket_t * ctrl)
+vtc_print_stats (vcl_test_session_t * ctrl)
 {
-  int is_echo = ctrl->cfg.test == SOCK_TEST_TYPE_ECHO;
+  int is_echo = ctrl->cfg.test == VCL_TEST_TYPE_ECHO;
   int show_rx = 0;
   char buf[64];
 
-  if (ctrl->cfg.test == SOCK_TEST_TYPE_BI
-      || ctrl->cfg.test == SOCK_TEST_TYPE_ECHO)
+  if (ctrl->cfg.test == VCL_TEST_TYPE_BI
+      || ctrl->cfg.test == VCL_TEST_TYPE_ECHO)
     show_rx = 1;
 
-  sock_test_stats_dump ("CLIENT RESULTS", &ctrl->stats,
-			show_rx, 1 /* show tx */ ,
-			ctrl->cfg.verbose);
-  sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+  vcl_test_stats_dump ("CLIENT RESULTS", &ctrl->stats,
+		       show_rx, 1 /* show tx */ ,
+		       ctrl->cfg.verbose);
+  vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
 
   if (ctrl->cfg.verbose)
     {
-      vtinf ("  ctrl socket info\n"
-	     SOCK_TEST_SEPARATOR_STRING
+      vtinf ("  ctrl session info\n"
+	     VCL_TEST_SEPARATOR_STRING
 	     "          fd:  %d (0x%08x)\n"
 	     "       rxbuf:  %p\n"
 	     "  rxbuf size:  %u (0x%08x)\n"
 	     "       txbuf:  %p\n"
 	     "  txbuf size:  %u (0x%08x)\n"
-	     SOCK_TEST_SEPARATOR_STRING,
+	     VCL_TEST_SEPARATOR_STRING,
 	     ctrl->fd, (uint32_t) ctrl->fd,
 	     ctrl->rxbuf, ctrl->rxbuf_size, ctrl->rxbuf_size,
 	     ctrl->txbuf, ctrl->txbuf_size, ctrl->txbuf_size);
@@ -444,18 +444,15 @@
     sprintf (buf, "Echo");
   else
     sprintf (buf, "%s-directional Stream",
-	     ctrl->cfg.test == SOCK_TEST_TYPE_BI ? "Bi" : "Uni");
-
-  vtinf ("(fd %d): %s Test Complete!\n"
-	 SOCK_TEST_BANNER_STRING, ctrl->fd, buf);
+	     ctrl->cfg.test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
 }
 
 static void
 vtc_echo_client (vcl_test_client_main_t * vcm)
 {
   vcl_test_client_worker_t *wrk;
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
-  sock_test_cfg_t *cfg = &ctrl->cfg;
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
+  vcl_test_cfg_t *cfg = &ctrl->cfg;
 
   cfg->total_bytes = strlen (ctrl->txbuf) + 1;
   memset (&ctrl->stats, 0, sizeof (ctrl->stats));
@@ -477,15 +474,15 @@
 static void
 vtc_stream_client (vcl_test_client_main_t * vcm)
 {
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
-  sock_test_cfg_t *cfg = &ctrl->cfg;
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
+  vcl_test_cfg_t *cfg = &ctrl->cfg;
   vcl_test_client_worker_t *wrk;
-  sock_test_socket_t *tsock;
+  vcl_test_session_t *ts;
   int tx_bytes, rv;
   uint32_t i, n, sidx, n_conn, n_conn_per_wrk;
 
-  vtinf (SOCK_TEST_BANNER_STRING "%s-directional Stream Test!\n",
-	 ctrl->cfg.test == SOCK_TEST_TYPE_BI ? "Bi" : "Uni");
+  vtinf ("%s-directional Stream Test Starting!",
+	 ctrl->cfg.test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
 
   cfg->total_bytes = cfg->num_writes * cfg->txbuf_size;
   cfg->ctrl_handle = ~0;
@@ -494,18 +491,18 @@
       vtwrn ("test cfg sync failed -- aborting!");
       return;
     }
-  cfg->ctrl_handle = ((sock_test_cfg_t *) ctrl->rxbuf)->ctrl_handle;
+  cfg->ctrl_handle = ((vcl_test_cfg_t *) ctrl->rxbuf)->ctrl_handle;
   memset (&ctrl->stats, 0, sizeof (ctrl->stats));
 
-  n_conn = cfg->num_test_sockets;
+  n_conn = cfg->num_test_sessions;
   n_conn_per_wrk = n_conn / vcm->n_workers;
   for (i = 0; i < vcm->n_workers; i++)
     {
       wrk = &vcm->workers[i];
       wrk->wrk_index = i;
       wrk->cfg = ctrl->cfg;
-      wrk->cfg.num_test_sockets = vtc_min (n_conn_per_wrk, n_conn);
-      n_conn -= wrk->cfg.num_test_sockets;
+      wrk->cfg.num_test_sessions = vtc_min (n_conn_per_wrk, n_conn);
+      n_conn -= wrk->cfg.num_test_sessions;
     }
 
   for (i = 1; i < vcm->n_workers; i++)
@@ -519,9 +516,7 @@
   while (vcm->active_workers > 0)
     ;
 
-  clock_gettime (CLOCK_REALTIME, &ctrl->stats.stop);
-
-  vtinf ("(fd %d): Sending config on ctrl socket for stats...\n", ctrl->fd);
+  vtinf ("Sending config on ctrl session (fd %d) for stats...", ctrl->fd);
   if (vtc_cfg_sync (ctrl))
     {
       vtwrn ("test cfg sync failed -- aborting!");
@@ -530,7 +525,7 @@
 
   vtc_print_stats (ctrl);
 
-  ctrl->cfg.test = SOCK_TEST_TYPE_ECHO;
+  ctrl->cfg.test = VCL_TEST_TYPE_ECHO;
   ctrl->cfg.total_bytes = 0;
   if (vtc_cfg_sync (ctrl))
     vtwrn ("post-test cfg sync failed!");
@@ -542,23 +537,23 @@
 #define INDENT "\n  "
 
   printf ("CLIENT: Test configuration commands:"
-	  INDENT SOCK_TEST_TOKEN_HELP
+	  INDENT VCL_TEST_TOKEN_HELP
 	  "\t\t\tDisplay help."
-	  INDENT SOCK_TEST_TOKEN_EXIT
+	  INDENT VCL_TEST_TOKEN_EXIT
 	  "\t\t\tExit test client & server."
-	  INDENT SOCK_TEST_TOKEN_SHOW_CFG
+	  INDENT VCL_TEST_TOKEN_SHOW_CFG
 	  "\t\t\tShow the current test cfg."
-	  INDENT SOCK_TEST_TOKEN_RUN_UNI
+	  INDENT VCL_TEST_TOKEN_RUN_UNI
 	  "\t\t\tRun the Uni-directional test."
-	  INDENT SOCK_TEST_TOKEN_RUN_BI
+	  INDENT VCL_TEST_TOKEN_RUN_BI
 	  "\t\t\tRun the Bi-directional test."
-	  INDENT SOCK_TEST_TOKEN_VERBOSE
+	  INDENT VCL_TEST_TOKEN_VERBOSE
 	  "\t\t\tToggle verbose setting."
-	  INDENT SOCK_TEST_TOKEN_RXBUF_SIZE
+	  INDENT VCL_TEST_TOKEN_RXBUF_SIZE
 	  "<rxbuf size>\tRx buffer size (bytes)."
-	  INDENT SOCK_TEST_TOKEN_TXBUF_SIZE
+	  INDENT VCL_TEST_TOKEN_TXBUF_SIZE
 	  "<txbuf size>\tTx buffer size (bytes)."
-	  INDENT SOCK_TEST_TOKEN_NUM_WRITES
+	  INDENT VCL_TEST_TOKEN_NUM_WRITES
 	  "<# of writes>\tNumber of txbuf writes to server." "\n");
 }
 
@@ -566,62 +561,61 @@
 cfg_txbuf_size_set (void)
 {
   vcl_test_client_main_t *vcm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
-  char *p = ctrl->txbuf + strlen (SOCK_TEST_TOKEN_TXBUF_SIZE);
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
+  char *p = ctrl->txbuf + strlen (VCL_TEST_TOKEN_TXBUF_SIZE);
   uint64_t txbuf_size = strtoull ((const char *) p, NULL, 10);
 
-  if (txbuf_size >= SOCK_TEST_CFG_BUF_SIZE_MIN)
+  if (txbuf_size >= VCL_TEST_CFG_BUF_SIZE_MIN)
     {
       ctrl->cfg.txbuf_size = txbuf_size;
       ctrl->cfg.total_bytes = ctrl->cfg.num_writes * ctrl->cfg.txbuf_size;
-      sock_test_buf_alloc (&ctrl->cfg, 0 /* is_rxbuf */ ,
-			   (uint8_t **) & ctrl->txbuf, &ctrl->txbuf_size);
-      sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+      vcl_test_buf_alloc (&ctrl->cfg, 0 /* is_rxbuf */ ,
+			  (uint8_t **) & ctrl->txbuf, &ctrl->txbuf_size);
+      vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
     }
   else
-    fprintf (stderr, "CLIENT: ERROR: Invalid txbuf size (%lu) < "
-	     "minimum buf size (%u)!\n",
-	     txbuf_size, SOCK_TEST_CFG_BUF_SIZE_MIN);
+    vtwrn ("Invalid txbuf size (%lu) < minimum buf size (%u)!",
+	   txbuf_size, VCL_TEST_CFG_BUF_SIZE_MIN);
 }
 
 static void
 cfg_num_writes_set (void)
 {
   vcl_test_client_main_t *vcm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
-  char *p = ctrl->txbuf + strlen (SOCK_TEST_TOKEN_NUM_WRITES);
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
+  char *p = ctrl->txbuf + strlen (VCL_TEST_TOKEN_NUM_WRITES);
   uint32_t num_writes = strtoul ((const char *) p, NULL, 10);
 
   if (num_writes > 0)
     {
       ctrl->cfg.num_writes = num_writes;
       ctrl->cfg.total_bytes = ctrl->cfg.num_writes * ctrl->cfg.txbuf_size;
-      sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+      vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
     }
   else
     {
-      fprintf (stderr, "CLIENT: ERROR: invalid num writes: %u\n", num_writes);
+      vtwrn ("invalid num writes: %u", num_writes);
     }
 }
 
 static void
-cfg_num_test_sockets_set (void)
+cfg_num_test_sessions_set (void)
 {
   vcl_test_client_main_t *vcm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
-  char *p = ctrl->txbuf + strlen (SOCK_TEST_TOKEN_NUM_TEST_SCKTS);
-  uint32_t num_test_sockets = strtoul ((const char *) p, NULL, 10);
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
+  char *p = ctrl->txbuf + strlen (VCL_TEST_TOKEN_NUM_TEST_SESS);
+  uint32_t num_test_sessions = strtoul ((const char *) p, NULL, 10);
 
-  if ((num_test_sockets > 0) &&
-      (num_test_sockets <= SOCK_TEST_CFG_MAX_TEST_SCKTS))
+  if ((num_test_sessions > 0) &&
+      (num_test_sessions <= VCL_TEST_CFG_MAX_TEST_SESS))
     {
-      ctrl->cfg.num_test_sockets = num_test_sockets;
-      sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+      ctrl->cfg.num_test_sessions = num_test_sessions;
+      vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
     }
   else
     {
-      vtwrn ("invalid num test sockets: %u, (%d max)",
-	     num_test_sockets, SOCK_TEST_CFG_MAX_TEST_SCKTS);
+      vtwrn ("invalid num test sessions: %u, (%d max)",
+	     num_test_sessions, VCL_TEST_CFG_MAX_TEST_SESS);
     }
 }
 
@@ -629,83 +623,82 @@
 cfg_rxbuf_size_set (void)
 {
   vcl_test_client_main_t *vcm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
-  char *p = ctrl->txbuf + strlen (SOCK_TEST_TOKEN_RXBUF_SIZE);
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
+  char *p = ctrl->txbuf + strlen (VCL_TEST_TOKEN_RXBUF_SIZE);
   uint64_t rxbuf_size = strtoull ((const char *) p, NULL, 10);
 
-  if (rxbuf_size >= SOCK_TEST_CFG_BUF_SIZE_MIN)
+  if (rxbuf_size >= VCL_TEST_CFG_BUF_SIZE_MIN)
     {
       ctrl->cfg.rxbuf_size = rxbuf_size;
-      sock_test_buf_alloc (&ctrl->cfg, 1 /* is_rxbuf */ ,
-			   (uint8_t **) & ctrl->rxbuf, &ctrl->rxbuf_size);
-      sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+      vcl_test_buf_alloc (&ctrl->cfg, 1 /* is_rxbuf */ ,
+			  (uint8_t **) & ctrl->rxbuf, &ctrl->rxbuf_size);
+      vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
     }
   else
-    fprintf (stderr, "CLIENT: ERROR: Invalid rxbuf size (%lu) < "
-	     "minimum buf size (%u)!\n",
-	     rxbuf_size, SOCK_TEST_CFG_BUF_SIZE_MIN);
+    vtwrn ("Invalid rxbuf size (%lu) < minimum buf size (%u)!",
+	   rxbuf_size, VCL_TEST_CFG_BUF_SIZE_MIN);
 }
 
 static void
 cfg_verbose_toggle (void)
 {
   vcl_test_client_main_t *vcm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
 
   ctrl->cfg.verbose = ctrl->cfg.verbose ? 0 : 1;
-  sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+  vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
 
 }
 
-static sock_test_t
+static vcl_test_t
 parse_input ()
 {
   vcl_test_client_main_t *vcm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
-  sock_test_t rv = SOCK_TEST_TYPE_NONE;
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
+  vcl_test_t rv = VCL_TEST_TYPE_NONE;
 
-  if (!strncmp (SOCK_TEST_TOKEN_EXIT, ctrl->txbuf,
-		strlen (SOCK_TEST_TOKEN_EXIT)))
-    rv = SOCK_TEST_TYPE_EXIT;
+  if (!strncmp (VCL_TEST_TOKEN_EXIT, ctrl->txbuf,
+		strlen (VCL_TEST_TOKEN_EXIT)))
+    rv = VCL_TEST_TYPE_EXIT;
 
-  else if (!strncmp (SOCK_TEST_TOKEN_HELP, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_HELP)))
+  else if (!strncmp (VCL_TEST_TOKEN_HELP, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_HELP)))
     dump_help ();
 
-  else if (!strncmp (SOCK_TEST_TOKEN_SHOW_CFG, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_SHOW_CFG)))
+  else if (!strncmp (VCL_TEST_TOKEN_SHOW_CFG, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_SHOW_CFG)))
     vcm->dump_cfg = 1;
 
-  else if (!strncmp (SOCK_TEST_TOKEN_VERBOSE, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_VERBOSE)))
+  else if (!strncmp (VCL_TEST_TOKEN_VERBOSE, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_VERBOSE)))
     cfg_verbose_toggle ();
 
-  else if (!strncmp (SOCK_TEST_TOKEN_TXBUF_SIZE, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_TXBUF_SIZE)))
+  else if (!strncmp (VCL_TEST_TOKEN_TXBUF_SIZE, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_TXBUF_SIZE)))
     cfg_txbuf_size_set ();
 
-  else if (!strncmp (SOCK_TEST_TOKEN_NUM_TEST_SCKTS, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_NUM_TEST_SCKTS)))
-    cfg_num_test_sockets_set ();
+  else if (!strncmp (VCL_TEST_TOKEN_NUM_TEST_SESS, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_NUM_TEST_SESS)))
+    cfg_num_test_sessions_set ();
 
-  else if (!strncmp (SOCK_TEST_TOKEN_NUM_WRITES, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_NUM_WRITES)))
+  else if (!strncmp (VCL_TEST_TOKEN_NUM_WRITES, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_NUM_WRITES)))
     cfg_num_writes_set ();
 
-  else if (!strncmp (SOCK_TEST_TOKEN_RXBUF_SIZE, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_RXBUF_SIZE)))
+  else if (!strncmp (VCL_TEST_TOKEN_RXBUF_SIZE, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_RXBUF_SIZE)))
     cfg_rxbuf_size_set ();
 
-  else if (!strncmp (SOCK_TEST_TOKEN_RUN_UNI, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_RUN_UNI)))
-    rv = ctrl->cfg.test = SOCK_TEST_TYPE_UNI;
+  else if (!strncmp (VCL_TEST_TOKEN_RUN_UNI, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_RUN_UNI)))
+    rv = ctrl->cfg.test = VCL_TEST_TYPE_UNI;
 
-  else if (!strncmp (SOCK_TEST_TOKEN_RUN_BI, ctrl->txbuf,
-		     strlen (SOCK_TEST_TOKEN_RUN_BI)))
-    rv = ctrl->cfg.test = SOCK_TEST_TYPE_BI;
+  else if (!strncmp (VCL_TEST_TOKEN_RUN_BI, ctrl->txbuf,
+		     strlen (VCL_TEST_TOKEN_RUN_BI)))
+    rv = ctrl->cfg.test = VCL_TEST_TYPE_BI;
 
   else
-    rv = SOCK_TEST_TYPE_ECHO;
+    rv = VCL_TEST_TYPE_ECHO;
 
   return rv;
 }
@@ -714,7 +707,7 @@
 print_usage_and_exit (void)
 {
   fprintf (stderr,
-	   "sock_test_client [OPTIONS] <ipaddr> <port>\n"
+	   "vcl_test_client [OPTIONS] <ipaddr> <port>\n"
 	   "  OPTIONS\n"
 	   "  -h               Print this message and exit.\n"
 	   "  -6               Use IPv6\n"
@@ -735,7 +728,7 @@
 static void
 vtc_process_opts (vcl_test_client_main_t * vcm, int argc, char **argv)
 {
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
   int c, v;
 
   opterr = 0;
@@ -747,18 +740,18 @@
 	break;
 
       case 's':
-	if (sscanf (optarg, "0x%x", &ctrl->cfg.num_test_sockets) != 1)
-	  if (sscanf (optarg, "%u", &ctrl->cfg.num_test_sockets) != 1)
+	if (sscanf (optarg, "0x%x", &ctrl->cfg.num_test_sessions) != 1)
+	  if (sscanf (optarg, "%u", &ctrl->cfg.num_test_sessions) != 1)
 	    {
 	      vtwrn ("Invalid value for option -%c!", c);
 	      print_usage_and_exit ();
 	    }
-	if (!ctrl->cfg.num_test_sockets ||
-	    (ctrl->cfg.num_test_sockets > FD_SETSIZE))
+	if (!ctrl->cfg.num_test_sessions ||
+	    (ctrl->cfg.num_test_sessions > FD_SETSIZE))
 	  {
-	    vtwrn ("Invalid number of sockets (%d) specified for option -%c!"
+	    vtwrn ("Invalid number of sessions (%d) specified for option -%c!"
 		   "\n       Valid range is 1 - %d",
-		   ctrl->cfg.num_test_sockets, c, FD_SETSIZE);
+		   ctrl->cfg.num_test_sessions, c, FD_SETSIZE);
 	    print_usage_and_exit ();
 	  }
 	break;
@@ -774,7 +767,7 @@
 	break;
 
       case 'X':
-	vcm->post_test = SOCK_TEST_TYPE_EXIT;
+	vcm->post_test = VCL_TEST_TYPE_EXIT;
 	break;
 
       case 'E':
@@ -785,20 +778,20 @@
 	    print_usage_and_exit ();
 	  }
 	strcpy (ctrl->txbuf, optarg);
-	ctrl->cfg.test = SOCK_TEST_TYPE_ECHO;
+	ctrl->cfg.test = VCL_TEST_TYPE_ECHO;
 	break;
 
       case 'I':
-	if (sscanf (optarg, "0x%x", &ctrl->cfg.num_test_sockets) != 1)
-	  if (sscanf (optarg, "%d", &ctrl->cfg.num_test_sockets) != 1)
+	if (sscanf (optarg, "0x%x", &ctrl->cfg.num_test_sessions) != 1)
+	  if (sscanf (optarg, "%d", &ctrl->cfg.num_test_sessions) != 1)
 	    {
 	      vtwrn ("Invalid value for option -%c!", c);
 	      print_usage_and_exit ();
 	    }
-	if (ctrl->cfg.num_test_sockets > SOCK_TEST_CFG_MAX_TEST_SCKTS)
+	if (ctrl->cfg.num_test_sessions > VCL_TEST_CFG_MAX_TEST_SESS)
 	  {
-	    vtwrn ("value greater than max number test sockets (%d)!",
-		   SOCK_TEST_CFG_MAX_TEST_SCKTS);
+	    vtwrn ("value greater than max number test sessions (%d)!",
+		   VCL_TEST_CFG_MAX_TEST_SESS);
 	    print_usage_and_exit ();
 	  }
 	break;
@@ -820,17 +813,17 @@
 	      vtwrn ("Invalid value for option -%c!", c);
 	      print_usage_and_exit ();
 	    }
-	if (ctrl->cfg.rxbuf_size >= SOCK_TEST_CFG_BUF_SIZE_MIN)
+	if (ctrl->cfg.rxbuf_size >= VCL_TEST_CFG_BUF_SIZE_MIN)
 	  {
 	    ctrl->rxbuf_size = ctrl->cfg.rxbuf_size;
-	    sock_test_buf_alloc (&ctrl->cfg, 1 /* is_rxbuf */ ,
-				 (uint8_t **) & ctrl->rxbuf,
-				 &ctrl->rxbuf_size);
+	    vcl_test_buf_alloc (&ctrl->cfg, 1 /* is_rxbuf */ ,
+				(uint8_t **) & ctrl->rxbuf,
+				&ctrl->rxbuf_size);
 	  }
 	else
 	  {
 	    vtwrn ("rxbuf size (%lu) less than minumum (%u)",
-		   ctrl->cfg.rxbuf_size, SOCK_TEST_CFG_BUF_SIZE_MIN);
+		   ctrl->cfg.rxbuf_size, VCL_TEST_CFG_BUF_SIZE_MIN);
 	    print_usage_and_exit ();
 	  }
 
@@ -843,29 +836,29 @@
 	      vtwrn ("Invalid value for option -%c!", c);
 	      print_usage_and_exit ();
 	    }
-	if (ctrl->cfg.txbuf_size >= SOCK_TEST_CFG_BUF_SIZE_MIN)
+	if (ctrl->cfg.txbuf_size >= VCL_TEST_CFG_BUF_SIZE_MIN)
 	  {
 	    ctrl->txbuf_size = ctrl->cfg.txbuf_size;
-	    sock_test_buf_alloc (&ctrl->cfg, 0 /* is_rxbuf */ ,
-				 (uint8_t **) & ctrl->txbuf,
-				 &ctrl->txbuf_size);
+	    vcl_test_buf_alloc (&ctrl->cfg, 0 /* is_rxbuf */ ,
+				(uint8_t **) & ctrl->txbuf,
+				&ctrl->txbuf_size);
 	    ctrl->cfg.total_bytes =
 	      ctrl->cfg.num_writes * ctrl->cfg.txbuf_size;
 	  }
 	else
 	  {
 	    vtwrn ("txbuf size (%lu) less than minumum (%u)!",
-		   ctrl->cfg.txbuf_size, SOCK_TEST_CFG_BUF_SIZE_MIN);
+		   ctrl->cfg.txbuf_size, VCL_TEST_CFG_BUF_SIZE_MIN);
 	    print_usage_and_exit ();
 	  }
 	break;
 
       case 'U':
-	ctrl->cfg.test = SOCK_TEST_TYPE_UNI;
+	ctrl->cfg.test = VCL_TEST_TYPE_UNI;
 	break;
 
       case 'B':
-	ctrl->cfg.test = SOCK_TEST_TYPE_BI;
+	ctrl->cfg.test = VCL_TEST_TYPE_BI;
 	break;
 
       case 'V':
@@ -937,10 +930,10 @@
 }
 
 static void
-vtc_read_user_input (sock_test_socket_t * ctrl)
+vtc_read_user_input (vcl_test_session_t * ctrl)
 {
   printf ("\nType some characters and hit <return>\n"
-	  "('" SOCK_TEST_TOKEN_HELP "' for help): ");
+	  "('" VCL_TEST_TOKEN_HELP "' for help): ");
 
   if (fgets (ctrl->txbuf, ctrl->txbuf_size, stdin) != NULL)
     {
@@ -960,18 +953,17 @@
 vtc_ctrl_session_exit (void)
 {
   vcl_test_client_main_t *vcm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
   int verbose = ctrl->cfg.verbose;
 
-  ctrl->cfg.test = SOCK_TEST_TYPE_EXIT;
+  ctrl->cfg.test = VCL_TEST_TYPE_EXIT;
   if (verbose)
     {
       vtinf ("(fd %d): Sending exit cfg to server...", ctrl->fd);
-      sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+      vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
     }
   (void) vcl_test_write (ctrl->fd, (uint8_t *) & ctrl->cfg,
 			 sizeof (ctrl->cfg), &ctrl->stats, verbose);
-  vtinf ("So long and thanks for all the fish!\n\n");
   sleep (1);
 }
 
@@ -979,12 +971,12 @@
 main (int argc, char **argv)
 {
   vcl_test_client_main_t *vcm = &vcl_client_main;
-  sock_test_socket_t *ctrl = &vcm->ctrl_socket;
+  vcl_test_session_t *ctrl = &vcm->ctrl_session;
   int rv, errno_val;
 
   vcm->n_workers = 1;
-  sock_test_cfg_init (&ctrl->cfg);
-  sock_test_socket_buf_alloc (ctrl);
+  vcl_test_cfg_init (&ctrl->cfg);
+  vcl_test_session_buf_alloc (ctrl);
   vtc_process_opts (vcm, argc, argv);
 
   vcm->workers = calloc (vcm->n_workers, sizeof (vcl_test_client_worker_t));
@@ -1000,63 +992,63 @@
   rv = vppcom_session_connect (ctrl->fd, &vcm->server_endpt);
   if (rv)
     vtfail ("vppcom_session_connect()", rv);
-  vtinf ("(fd %d): Control socket connected.", ctrl->fd);
+  vtinf ("Control session (fd %d) connected.", ctrl->fd);
 
   rv = vtc_cfg_sync (ctrl);
   if (rv)
     vtfail ("vtc_cfg_sync()", rv);
 
-  ctrl->cfg.ctrl_handle = ((sock_test_cfg_t *) ctrl->rxbuf)->ctrl_handle;
+  ctrl->cfg.ctrl_handle = ((vcl_test_cfg_t *) ctrl->rxbuf)->ctrl_handle;
   memset (&ctrl->stats, 0, sizeof (ctrl->stats));
 
-  while (ctrl->cfg.test != SOCK_TEST_TYPE_EXIT)
+  while (ctrl->cfg.test != VCL_TEST_TYPE_EXIT)
     {
       if (vcm->dump_cfg)
 	{
-	  sock_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+	  vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
 	  vcm->dump_cfg = 0;
 	}
 
       switch (ctrl->cfg.test)
 	{
-	case SOCK_TEST_TYPE_ECHO:
+	case VCL_TEST_TYPE_ECHO:
 	  vtc_echo_client (vcm);
 	  break;
 
-	case SOCK_TEST_TYPE_UNI:
-	case SOCK_TEST_TYPE_BI:
+	case VCL_TEST_TYPE_UNI:
+	case VCL_TEST_TYPE_BI:
 	  vtc_stream_client (vcm);
 	  break;
 
-	case SOCK_TEST_TYPE_EXIT:
+	case VCL_TEST_TYPE_EXIT:
 	  continue;
 
-	case SOCK_TEST_TYPE_NONE:
+	case VCL_TEST_TYPE_NONE:
 	default:
 	  break;
 	}
       switch (vcm->post_test)
 	{
-	case SOCK_TEST_TYPE_EXIT:
+	case VCL_TEST_TYPE_EXIT:
 	  switch (ctrl->cfg.test)
 	    {
-	    case SOCK_TEST_TYPE_EXIT:
-	    case SOCK_TEST_TYPE_UNI:
-	    case SOCK_TEST_TYPE_BI:
-	    case SOCK_TEST_TYPE_ECHO:
-	      ctrl->cfg.test = SOCK_TEST_TYPE_EXIT;
+	    case VCL_TEST_TYPE_EXIT:
+	    case VCL_TEST_TYPE_UNI:
+	    case VCL_TEST_TYPE_BI:
+	    case VCL_TEST_TYPE_ECHO:
+	      ctrl->cfg.test = VCL_TEST_TYPE_EXIT;
 	      continue;
 
-	    case SOCK_TEST_TYPE_NONE:
+	    case VCL_TEST_TYPE_NONE:
 	    default:
 	      break;
 	    }
 	  break;
 
-	case SOCK_TEST_TYPE_NONE:
-	case SOCK_TEST_TYPE_ECHO:
-	case SOCK_TEST_TYPE_UNI:
-	case SOCK_TEST_TYPE_BI:
+	case VCL_TEST_TYPE_NONE:
+	case VCL_TEST_TYPE_ECHO:
+	case VCL_TEST_TYPE_UNI:
+	case VCL_TEST_TYPE_BI:
 	default:
 	  break;
 	}
diff --git a/src/vcl/vcl_test_server.c b/src/vcl/vcl_test_server.c
index 2913452..54f164e 100644
--- a/src/vcl/vcl_test_server.c
+++ b/src/vcl/vcl_test_server.c
@@ -34,8 +34,8 @@
   int fd;
   uint8_t *buf;
   uint32_t buf_size;
-  sock_test_cfg_t cfg;
-  sock_test_stats_t stats;
+  vcl_test_cfg_t cfg;
+  vcl_test_stats_t stats;
   vppcom_endpt_t endpt;
   uint8_t ip[16];
   vppcom_data_segments_t ds;
@@ -50,15 +50,12 @@
   vppcom_endpt_t endpt;
 } vcl_test_server_cfg_t;
 
-#define SOCK_SERVER_MAX_TEST_CONN  16
-#define SOCK_SERVER_MAX_EPOLL_EVENTS 16
-
 typedef struct
 {
   uint32_t wrk_index;
   int listen_fd;
   int epfd;
-  struct epoll_event wait_events[SOCK_SERVER_MAX_EPOLL_EVENTS];
+  struct epoll_event wait_events[VCL_TEST_CFG_MAX_EPOLL_EVENTS];
   size_t conn_pool_size;
   vcl_test_server_conn_t *conn_pool;
   int nfds;
@@ -78,7 +75,7 @@
 
 static __thread int __wrk_index = 0;
 
-static vcl_test_server_main_t sock_server_main;
+static vcl_test_server_main_t vcl_server_main;
 
 static inline void
 conn_pool_expand (vcl_test_server_worker_t * wrk, size_t expand_size)
@@ -94,9 +91,9 @@
 	{
 	  vcl_test_server_conn_t *conn = &conn_pool[i];
 	  memset (conn, 0, sizeof (*conn));
-	  sock_test_cfg_init (&conn->cfg);
-	  sock_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */ ,
-			       &conn->buf, &conn->buf_size);
+	  vcl_test_cfg_init (&conn->cfg);
+	  vcl_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */ ,
+			      &conn->buf, &conn->buf_size);
 	  conn->cfg.txbuf_size = conn->cfg.rxbuf_size;
 	}
 
@@ -143,18 +140,17 @@
 }
 
 static inline void
-sync_config_and_reply (vcl_test_server_conn_t * conn,
-		       sock_test_cfg_t * rx_cfg)
+sync_config_and_reply (vcl_test_server_conn_t * conn, vcl_test_cfg_t * rx_cfg)
 {
   conn->cfg = *rx_cfg;
-  sock_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */ ,
-		       &conn->buf, &conn->buf_size);
+  vcl_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */ ,
+		      &conn->buf, &conn->buf_size);
   conn->cfg.txbuf_size = conn->cfg.rxbuf_size;
 
   if (conn->cfg.verbose)
     {
       vtinf ("(fd %d): Replying to cfg message!\n", conn->fd);
-      sock_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
+      vcl_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
     }
   (void) vcl_test_write (conn->fd, (uint8_t *) & conn->cfg,
 			 sizeof (conn->cfg), NULL, conn->cfg.verbose);
@@ -162,60 +158,62 @@
 
 static void
 vts_server_start_stop (vcl_test_server_worker_t * wrk,
-		       vcl_test_server_conn_t * conn,
-		       sock_test_cfg_t * rx_cfg)
+		       vcl_test_server_conn_t * conn, vcl_test_cfg_t * rx_cfg)
 {
-  u8 is_bi = rx_cfg->test == SOCK_TEST_TYPE_BI;
-  int client_fd = conn->fd, i;
+  u8 is_bi = rx_cfg->test == VCL_TEST_TYPE_BI;
   vcl_test_server_conn_t *tc;
   char buf[64];
+  int i;
 
   if (rx_cfg->ctrl_handle == conn->fd)
     {
-      clock_gettime (CLOCK_REALTIME, &conn->stats.stop);
-
       for (i = 0; i < wrk->conn_pool_size; i++)
 	{
 	  tc = &wrk->conn_pool[i];
 	  if (tc->cfg.ctrl_handle != conn->fd)
 	    continue;
 
-	  sock_test_stats_accumulate (&conn->stats, &tc->stats);
-
+	  vcl_test_stats_accumulate (&conn->stats, &tc->stats);
+	  if (vcl_comp_tspec (&conn->stats.stop, &tc->stats.stop) < 0)
+	    conn->stats.stop = tc->stats.stop;
+	  /* Client delays sending of disconnect */
+	  conn->stats.stop.tv_sec -= VCL_TEST_DELAY_DISCONNECT;
 	  if (conn->cfg.verbose)
 	    {
 	      sprintf (buf, "SERVER (fd %d) RESULTS", tc->fd);
-	      sock_test_stats_dump (buf, &tc->stats, 1 /* show_rx */ ,
-				    is_bi /* show tx */ , conn->cfg.verbose);
+	      vcl_test_stats_dump (buf, &tc->stats, 1 /* show_rx */ ,
+				   is_bi /* show tx */ , conn->cfg.verbose);
 	    }
 	}
 
-      sock_test_stats_dump ("SERVER RESULTS", &conn->stats, 1 /* show_rx */ ,
-			    is_bi /* show_tx */ , conn->cfg.verbose);
-      sock_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
+      vcl_test_stats_dump ("SERVER RESULTS", &conn->stats, 1 /* show_rx */ ,
+			   is_bi /* show_tx */ , conn->cfg.verbose);
+      vcl_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
       if (conn->cfg.verbose)
 	{
-	  vtinf ("  sock server main\n"
-		 SOCK_TEST_SEPARATOR_STRING
+	  vtinf ("  vcl server main\n"
+		 VCL_TEST_SEPARATOR_STRING
 		 "       buf:  %p\n"
 		 "  buf size:  %u (0x%08x)\n"
-		 SOCK_TEST_SEPARATOR_STRING,
+		 VCL_TEST_SEPARATOR_STRING,
 		 conn->buf, conn->buf_size, conn->buf_size);
 	}
 
       sync_config_and_reply (conn, rx_cfg);
-      vtinf ("(fd %d): %s-directional Stream Test Complete!\n"
-	     SOCK_TEST_BANNER_STRING "\n", conn->fd, is_bi ? "Bi" : "Uni");
       memset (&conn->stats, 0, sizeof (conn->stats));
     }
   else
     {
-      vtinf (SOCK_TEST_BANNER_STRING "(fd %d): %s-directional Stream Test!\n"
-	     "  Sending client the test cfg to start streaming data...\n",
-	     client_fd, is_bi ? "Bi" : "Uni");
-
       if (rx_cfg->ctrl_handle == ~0)
-	rx_cfg->ctrl_handle = conn->fd;
+	{
+	  rx_cfg->ctrl_handle = conn->fd;
+	  vtinf ("Set control fd %d for test!", conn->fd);
+	}
+      else
+	{
+	  vtinf ("Starting %s-directional Stream Test (fd %d)!",
+		 is_bi ? "Bi" : "Uni", conn->fd);
+	}
 
       sync_config_and_reply (conn, rx_cfg);
 
@@ -228,12 +226,12 @@
 static inline void
 vts_server_rx (vcl_test_server_conn_t * conn, int rx_bytes)
 {
-  vcl_test_server_main_t *vts = &sock_server_main;
+  vcl_test_server_main_t *vsm = &vcl_server_main;
   int client_fd = conn->fd;
 
-  if (conn->cfg.test == SOCK_TEST_TYPE_BI)
+  if (conn->cfg.test == VCL_TEST_TYPE_BI)
     {
-      if (vts->use_ds)
+      if (vsm->use_ds)
 	{
 	  (void) vcl_test_write (client_fd, conn->ds[0].data, conn->ds[0].len,
 				 &conn->stats, conn->cfg.verbose);
@@ -247,7 +245,7 @@
 			       conn->cfg.verbose);
     }
 
-  if (vts->use_ds)
+  if (vsm->use_ds)
     vppcom_session_free_segments (conn->fd, conn->ds);
 
   if (conn->stats.rx_bytes >= conn->cfg.total_bytes)
@@ -257,10 +255,10 @@
 static void
 vts_server_echo (vcl_test_server_conn_t * conn, int rx_bytes)
 {
-  vcl_test_server_main_t *vts = &sock_server_main;
+  vcl_test_server_main_t *vsm = &vcl_server_main;
   int tx_bytes, nbytes, pos;
 
-  if (vts->use_ds)
+  if (vsm->use_ds)
     vppcom_data_segment_copy (conn->buf, conn->ds, rx_bytes);
 
   /* If it looks vaguely like a string, make sure it's terminated */
@@ -278,11 +276,12 @@
     vtinf ("(fd %d): TX (%d bytes) - '%s'", conn->fd, tx_bytes, conn->buf);
 }
 
-static inline void
+static void
 vts_new_client (vcl_test_server_worker_t * wrk)
 {
-  int client_fd;
   vcl_test_server_conn_t *conn;
+  struct epoll_event ev;
+  int rv, client_fd;
 
   conn = conn_pool_alloc (wrk);
   if (!conn)
@@ -297,32 +296,26 @@
       vterr ("vppcom_session_accept()", client_fd);
       return;
     }
+  conn->fd = client_fd;
 
   vtinf ("Got a connection -- fd = %d (0x%08x)!", client_fd, client_fd);
 
-  conn->fd = client_fd;
-
-  {
-    struct epoll_event ev;
-    int rv;
-
-    ev.events = EPOLLIN;
-    ev.data.u64 = conn - wrk->conn_pool;
-    rv = vppcom_epoll_ctl (wrk->epfd, EPOLL_CTL_ADD, client_fd, &ev);
-    if (rv < 0)
-      {
-	vterr ("vppcom_epoll_ctl()", rv);
-	return;
-      }
-    wrk->nfds++;
-  }
+  ev.events = EPOLLIN;
+  ev.data.u64 = conn - wrk->conn_pool;
+  rv = vppcom_epoll_ctl (wrk->epfd, EPOLL_CTL_ADD, client_fd, &ev);
+  if (rv < 0)
+    {
+      vterr ("vppcom_epoll_ctl()", rv);
+      return;
+    }
+  wrk->nfds++;
 }
 
-void
+static void
 print_usage_and_exit (void)
 {
   fprintf (stderr,
-	   "sock_test_server [OPTIONS] <port>\n"
+	   "vcl_test_server [OPTIONS] <port>\n"
 	   "  OPTIONS\n"
 	   "  -h               Print this message and exit.\n"
 	   "  -6               Use IPv6\n"
@@ -332,71 +325,71 @@
 }
 
 static void
-vcl_test_init_endpoint_addr (vcl_test_server_main_t * ssm)
+vcl_test_init_endpoint_addr (vcl_test_server_main_t * vsm)
 {
-  struct sockaddr_storage *servaddr = &ssm->servaddr;
+  struct sockaddr_storage *servaddr = &vsm->servaddr;
   memset (servaddr, 0, sizeof (*servaddr));
 
-  if (ssm->cfg.address_ip6)
+  if (vsm->cfg.address_ip6)
     {
       struct sockaddr_in6 *server_addr = (struct sockaddr_in6 *) servaddr;
       server_addr->sin6_family = AF_INET6;
       server_addr->sin6_addr = in6addr_any;
-      server_addr->sin6_port = htons (ssm->cfg.port);
+      server_addr->sin6_port = htons (vsm->cfg.port);
     }
   else
     {
       struct sockaddr_in *server_addr = (struct sockaddr_in *) servaddr;
       server_addr->sin_family = AF_INET;
       server_addr->sin_addr.s_addr = htonl (INADDR_ANY);
-      server_addr->sin_port = htons (ssm->cfg.port);
+      server_addr->sin_port = htons (vsm->cfg.port);
     }
 
-  if (ssm->cfg.address_ip6)
+  if (vsm->cfg.address_ip6)
     {
       struct sockaddr_in6 *server_addr = (struct sockaddr_in6 *) servaddr;
-      ssm->cfg.endpt.is_ip4 = 0;
-      ssm->cfg.endpt.ip = (uint8_t *) & server_addr->sin6_addr;
-      ssm->cfg.endpt.port = (uint16_t) server_addr->sin6_port;
+      vsm->cfg.endpt.is_ip4 = 0;
+      vsm->cfg.endpt.ip = (uint8_t *) & server_addr->sin6_addr;
+      vsm->cfg.endpt.port = (uint16_t) server_addr->sin6_port;
     }
   else
     {
       struct sockaddr_in *server_addr = (struct sockaddr_in *) servaddr;
-      ssm->cfg.endpt.is_ip4 = 1;
-      ssm->cfg.endpt.ip = (uint8_t *) & server_addr->sin_addr;
-      ssm->cfg.endpt.port = (uint16_t) server_addr->sin_port;
+      vsm->cfg.endpt.is_ip4 = 1;
+      vsm->cfg.endpt.ip = (uint8_t *) & server_addr->sin_addr;
+      vsm->cfg.endpt.port = (uint16_t) server_addr->sin_port;
     }
 }
 
 static void
-vcl_test_server_process_opts (vcl_test_server_main_t * ssm, int argc,
+vcl_test_server_process_opts (vcl_test_server_main_t * vsm, int argc,
 			      char **argv)
 {
   int v, c;
 
-  ssm->cfg.proto = VPPCOM_PROTO_TCP;
+  vsm->cfg.proto = VPPCOM_PROTO_TCP;
 
   opterr = 0;
   while ((c = getopt (argc, argv, "6Dsw:")) != -1)
     switch (c)
       {
       case '6':
-	ssm->cfg.address_ip6 = 1;
+	vsm->cfg.address_ip6 = 1;
 	break;
 
       case 'D':
-	ssm->cfg.proto = VPPCOM_PROTO_UDP;
+	vsm->cfg.proto = VPPCOM_PROTO_UDP;
 	break;
 
       case 'w':
 	v = atoi (optarg);
 	if (v > 1)
-	  ssm->cfg.workers = v;
+	  vsm->cfg.workers = v;
 	else
 	  vtwrn ("Invalid number of workers %d", v);
 	break;
       case 's':
-	ssm->use_ds = 1;
+	vsm->use_ds = 1;
 	break;
       case '?':
 	switch (optopt)
@@ -420,24 +413,24 @@
     }
 
   if (sscanf (argv[optind], "%d", &v) == 1)
-    ssm->cfg.port = (uint16_t) v;
+    vsm->cfg.port = (uint16_t) v;
   else
     {
       fprintf (stderr, "SERVER: ERROR: Invalid port (%s)!\n", argv[optind]);
       print_usage_and_exit ();
     }
 
-  vcl_test_init_endpoint_addr (ssm);
+  vcl_test_init_endpoint_addr (vsm);
 }
 
 int
-vts_handle_cfg (vcl_test_server_worker_t * wrk, sock_test_cfg_t * rx_cfg,
+vts_handle_cfg (vcl_test_server_worker_t * wrk, vcl_test_cfg_t * rx_cfg,
 		vcl_test_server_conn_t * conn, int rx_bytes)
 {
   if (rx_cfg->verbose)
     {
       vtinf ("(fd %d): Received a cfg msg!", conn->fd);
-      sock_test_cfg_dump (rx_cfg, 0 /* is_client */ );
+      vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
     }
 
   if (rx_bytes != sizeof (*rx_cfg))
@@ -449,7 +442,7 @@
       if (conn->cfg.verbose)
 	{
 	  vtinf ("(fd %d): Replying to cfg msg", conn->fd);
-	  sock_test_cfg_dump (rx_cfg, 0 /* is_client */ );
+	  vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
 	}
       vcl_test_write (conn->fd, (uint8_t *) & conn->cfg,
 		      sizeof (conn->cfg), NULL, conn->cfg.verbose);
@@ -458,18 +451,19 @@
 
   switch (rx_cfg->test)
     {
-    case SOCK_TEST_TYPE_NONE:
-    case SOCK_TEST_TYPE_ECHO:
+    case VCL_TEST_TYPE_NONE:
+    case VCL_TEST_TYPE_ECHO:
       sync_config_and_reply (conn, rx_cfg);
       break;
 
-    case SOCK_TEST_TYPE_BI:
-    case SOCK_TEST_TYPE_UNI:
+    case VCL_TEST_TYPE_BI:
+    case VCL_TEST_TYPE_UNI:
       vts_server_start_stop (wrk, conn, rx_cfg);
       break;
 
-    case SOCK_TEST_TYPE_EXIT:
-      vtinf ("Have a great day conn %d (closing)!", conn->fd);
+    case VCL_TEST_TYPE_EXIT:
+      vtinf ("Session fd %d closing!", conn->fd);
+      clock_gettime (CLOCK_REALTIME, &conn->stats.stop);
       vppcom_session_close (conn->fd);
       conn_pool_free (conn);
       wrk->nfds--;
@@ -477,7 +471,7 @@
 
     default:
       vtwrn ("Unknown test type %d", rx_cfg->test);
-      sock_test_cfg_dump (rx_cfg, 0 /* is_client */ );
+      vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
       break;
     }
 
@@ -487,7 +481,7 @@
 static void
 vts_worker_init (vcl_test_server_worker_t * wrk)
 {
-  vcl_test_server_main_t *ssm = &sock_server_main;
+  vcl_test_server_main_t *vsm = &vcl_server_main;
   struct epoll_event listen_ev;
   int rv;
 
@@ -495,21 +489,21 @@
 
   vtinf ("Initializing worker ...");
 
-  conn_pool_expand (wrk, SOCK_SERVER_MAX_TEST_CONN + 1);
+  conn_pool_expand (wrk, VCL_TEST_CFG_MAX_TEST_SESS + 1);
   if (wrk->wrk_index)
     if (vppcom_worker_register ())
       vtfail ("vppcom_worker_register()", 1);
 
-  wrk->listen_fd = vppcom_session_create (ssm->cfg.proto,
+  wrk->listen_fd = vppcom_session_create (vsm->cfg.proto,
 					  0 /* is_nonblocking */ );
   if (wrk->listen_fd < 0)
     vtfail ("vppcom_session_create()", wrk->listen_fd);
 
-  rv = vppcom_session_bind (wrk->listen_fd, &ssm->cfg.endpt);
+  rv = vppcom_session_bind (wrk->listen_fd, &vsm->cfg.endpt);
   if (rv < 0)
     vtfail ("vppcom_session_bind()", rv);
 
-  if (!(ssm->cfg.proto == VPPCOM_PROTO_UDP))
+  if (!(vsm->cfg.proto == VPPCOM_PROTO_UDP))
     {
       rv = vppcom_session_listen (wrk->listen_fd, 10);
       if (rv < 0)
@@ -527,41 +521,39 @@
   if (rv < 0)
     vtfail ("vppcom_epoll_ctl", rv);
 
-  ssm->active_workers += 1;
-  vtinf ("Waiting for a client to connect on port %d ...", ssm->cfg.port);
+  vsm->active_workers += 1;
+  vtinf ("Waiting for a client to connect on port %d ...", vsm->cfg.port);
 }
 
 static int
 vts_conn_expect_config (vcl_test_server_conn_t * conn)
 {
-  if (conn->cfg.test == SOCK_TEST_TYPE_ECHO)
+  if (conn->cfg.test == VCL_TEST_TYPE_ECHO)
     return 1;
 
   return (conn->stats.rx_bytes < 128
-	  || conn->stats.rx_bytes >= conn->cfg.total_bytes);
+	  || conn->stats.rx_bytes > conn->cfg.total_bytes);
 }
 
-static sock_test_cfg_t *
+static vcl_test_cfg_t *
 vts_conn_read_config (vcl_test_server_conn_t * conn)
 {
-  vcl_test_server_main_t *vts = &sock_server_main;
+  vcl_test_server_main_t *vsm = &vcl_server_main;
 
-  if (vts->use_ds)
+  if (vsm->use_ds)
     {
       /* We could avoid the copy if the first segment is big enough but this
        * just simplifies things */
-      vppcom_data_segment_copy (conn->buf, conn->ds,
-				sizeof (sock_test_cfg_t));
-      vppcom_session_free_segments (conn->fd, conn->ds);
+      vppcom_data_segment_copy (conn->buf, conn->ds, sizeof (vcl_test_cfg_t));
     }
-  return (sock_test_cfg_t *) conn->buf;
+  return (vcl_test_cfg_t *) conn->buf;
 }
 
 static inline int
 vts_conn_read (vcl_test_server_conn_t * conn)
 {
-  vcl_test_server_main_t *vts = &sock_server_main;
-  if (vts->use_ds)
+  vcl_test_server_main_t *vsm = &vcl_server_main;
+  if (vsm->use_ds)
     return vcl_test_read_ds (conn->fd, conn->ds, &conn->stats);
   else
     return vcl_test_read (conn->fd, conn->buf, conn->buf_size, &conn->stats);
@@ -570,9 +562,9 @@
 static inline int
 vts_conn_has_ascii (vcl_test_server_conn_t * conn)
 {
-  vcl_test_server_main_t *vts = &sock_server_main;
+  vcl_test_server_main_t *vsm = &vcl_server_main;
 
-  if (vts->use_ds)
+  if (vsm->use_ds)
     return isascii (conn->ds[0].data[0]);
   else
     return isascii (conn->buf[0]);
@@ -581,11 +573,11 @@
 static void *
 vts_worker_loop (void *arg)
 {
-  vcl_test_server_main_t *ssm = &sock_server_main;
+  vcl_test_server_main_t *vsm = &vcl_server_main;
   vcl_test_server_worker_t *wrk = arg;
   vcl_test_server_conn_t *conn;
   int i, rx_bytes, num_ev;
-  sock_test_cfg_t *rx_cfg;
+  vcl_test_cfg_t *rx_cfg;
 
   if (wrk->wrk_index)
     vts_worker_init (wrk);
@@ -593,7 +585,7 @@
   while (1)
     {
       num_ev = vppcom_epoll_wait (wrk->epfd, wrk->wait_events,
-				  SOCK_SERVER_MAX_EPOLL_EVENTS, 60000.0);
+				  VCL_TEST_CFG_MAX_EPOLL_EVENTS, 60000.0);
       if (num_ev < 0)
 	{
 	  vterr ("vppcom_epoll_wait()", num_ev);
@@ -643,8 +635,10 @@
 	      if (vts_conn_expect_config (conn))
 		{
 		  rx_cfg = vts_conn_read_config (conn);
-		  if (rx_cfg->magic == SOCK_TEST_CFG_CTRL_MAGIC)
+		  if (rx_cfg->magic == VCL_TEST_CFG_CTRL_MAGIC)
 		    {
+		      if (vsm->use_ds)
+			vppcom_session_free_segments (conn->fd, conn->ds);
 		      vts_handle_cfg (wrk, rx_cfg, conn, rx_bytes);
 		      if (!wrk->nfds)
 			{
@@ -654,8 +648,8 @@
 		      continue;
 		    }
 		}
-	      if ((conn->cfg.test == SOCK_TEST_TYPE_UNI)
-		  || (conn->cfg.test == SOCK_TEST_TYPE_BI))
+	      if ((conn->cfg.test == VCL_TEST_TYPE_UNI)
+		  || (conn->cfg.test == VCL_TEST_TYPE_BI))
 		{
 		  vts_server_rx (conn, rx_bytes);
 		  if (vppcom_session_attr (conn->fd, VPPCOM_ATTR_GET_NREAD, 0,
@@ -681,24 +675,24 @@
     }
 
 fail:
-  ssm->worker_fails -= 1;
+  vsm->worker_fails -= 1;
 
 done:
   vppcom_session_close (wrk->listen_fd);
   if (wrk->conn_pool)
     free (wrk->conn_pool);
-  ssm->active_workers -= 1;
+  vsm->active_workers -= 1;
   return 0;
 }
 
 int
 main (int argc, char **argv)
 {
-  vcl_test_server_main_t *vsm = &sock_server_main;
+  vcl_test_server_main_t *vsm = &vcl_server_main;
   int rv, i;
 
   clib_mem_init_thread_safe (0, 64 << 20);
-  vsm->cfg.port = SOCK_TEST_SERVER_PORT;
+  vsm->cfg.port = VCL_TEST_SERVER_PORT;
   vsm->cfg.workers = 1;
   vsm->active_workers = 0;
   vcl_test_server_process_opts (vsm, argc, argv);
