diff --git a/src/vpp-api/python/vpp_papi/vpp_papi.py b/src/vpp-api/python/vpp_papi/vpp_papi.py
index 25f4727..3465f50 100644
--- a/src/vpp-api/python/vpp_papi/vpp_papi.py
+++ b/src/vpp-api/python/vpp_papi/vpp_papi.py
@@ -44,6 +44,8 @@
 
     VppTransport = V
 
+from . vpp_transport_socket import VppTransport
+
 logger = logging.getLogger('vpp_papi')
 logger.addHandler(logging.NullHandler())
 
@@ -422,16 +424,10 @@
         self.async_thread = async_thread
         self.event_thread = None
         self.testmode = testmode
-        self.use_socket = use_socket
         self.server_address = server_address
         self._apifiles = apifiles
         self.stats = {}
 
-        if use_socket:
-            from . vpp_transport_socket import VppTransport
-        else:
-            from . vpp_transport_shmem import VppTransport
-
         if not apifiles:
             # Pick up API definitions from default directory
             try:
@@ -906,11 +902,10 @@
 
     def __repr__(self):
         return "<VPPApiClient apifiles=%s, testmode=%s, async_thread=%s, " \
-               "logger=%s, read_timeout=%s, use_socket=%s, " \
+               "logger=%s, read_timeout=%s, " \
                "server_address='%s'>" % (
                    self._apifiles, self.testmode, self.async_thread,
-                   self.logger, self.read_timeout, self.use_socket,
-                   self.server_address)
+                   self.logger, self.read_timeout, self.server_address)
 
     def details_iter(self, f, **kwargs):
         cursor = 0
diff --git a/src/vpp-api/python/vpp_papi/vpp_transport_shmem.py b/src/vpp-api/python/vpp_papi/vpp_transport_shmem.py
deleted file mode 100644
index 4719f23..0000000
--- a/src/vpp-api/python/vpp_papi/vpp_transport_shmem.py
+++ /dev/null
@@ -1,143 +0,0 @@
-#
-# A transport class. With two implementations.
-# One for socket and one for shared memory.
-#
-import logging
-
-from cffi import FFI
-import cffi
-
-logger = logging.getLogger('vpp_papi.transport')
-logger.addHandler(logging.NullHandler())
-
-ffi = FFI()
-ffi.cdef("""
-typedef void (*vac_callback_t)(unsigned char * data, int len);
-typedef void (*vac_error_callback_t)(void *, unsigned char *, int);
-int vac_connect(char * name, char * chroot_prefix, vac_callback_t cb,
-    int rx_qlen);
-int vac_disconnect(void);
-int vac_read(char **data, int *l, unsigned short timeout);
-int vac_write(char *data, int len);
-void vac_free(void * msg);
-
-int vac_get_msg_index(unsigned char * name);
-int vac_msg_table_size(void);
-int vac_msg_table_max_index(void);
-
-void vac_rx_suspend (void);
-void vac_rx_resume (void);
-void vac_set_error_handler(vac_error_callback_t);
-void vac_mem_init (size_t size);
-""")
-
-vpp_object = None
-
-# allow file to be imported so it can be mocked in tests.
-# If the shared library fails, VppTransport cannot be initialized.
-try:
-    vpp_api = ffi.dlopen('libvppapiclient.so')
-except OSError:
-    vpp_api = None
-
-
-@ffi.callback("void(unsigned char *, int)")
-def vac_callback_sync(data, len):
-    vpp_object.msg_handler_sync(ffi.buffer(data, len))
-
-
-@ffi.callback("void(unsigned char *, int)")
-def vac_callback_async(data, len):
-    vpp_object.msg_handler_async(ffi.buffer(data, len))
-
-
-@ffi.callback("void(void *, unsigned char *, int)")
-def vac_error_handler(arg, msg, msg_len):
-    vpp_object.logger.warning("VPP API client:: %s", ffi.string(msg, msg_len))
-
-
-class VppTransportShmemIOError(IOError):
-    """ exception communicating with vpp over shared memory """
-
-    def __init__(self, rv, descr):
-        self.rv = rv
-        self.desc = descr
-
-        super(VppTransportShmemIOError, self).__init__(rv, descr)
-
-
-class VppTransport:
-    VppTransportShmemIOError = VppTransportShmemIOError
-
-    def __init__(self, parent, read_timeout, server_address):
-        self.connected = False
-        self.read_timeout = read_timeout
-        self.parent = parent
-        global vpp_object
-        vpp_object = parent
-
-        vpp_api.vac_mem_init(0)
-
-        # Register error handler
-        vpp_api.vac_set_error_handler(vac_error_handler)
-
-        # Support legacy CFFI
-        # from_buffer supported from 1.8.0
-        (major, minor, patch) = [int(s) for s in
-                                 cffi.__version__.split('.', 3)]
-        if major >= 1 and minor >= 8:
-            self.write = self._write_new_cffi
-        else:
-            self.write = self._write_legacy_cffi
-
-    def connect(self, name, pfx, msg_handler, rx_qlen):
-        self.connected = True
-        if not pfx:
-            pfx = ffi.NULL
-        return vpp_api.vac_connect(name.encode('ascii'), pfx, msg_handler, rx_qlen)
-
-    def disconnect(self):
-        self.connected = False
-        return vpp_api.vac_disconnect()
-
-    def suspend(self):
-        vpp_api.vac_rx_suspend()
-
-    def resume(self):
-        vpp_api.vac_rx_resume()
-
-    def get_callback(self, do_async):
-        return vac_callback_sync if not do_async else vac_callback_async
-
-    def get_msg_index(self, name):
-        return vpp_api.vac_get_msg_index(name.encode('ascii'))
-
-    def msg_table_max_index(self):
-        return vpp_api.vac_msg_table_max_index()
-
-    def _write_new_cffi(self, buf):
-        """Send a binary-packed message to VPP."""
-        if not self.connected:
-            raise VppTransportShmemIOError(1, 'Not connected')
-        return vpp_api.vac_write(ffi.from_buffer(buf), len(buf))
-
-    def _write_legacy_cffi(self, buf):
-        """Send a binary-packed message to VPP."""
-        if not self.connected:
-            raise VppTransportShmemIOError(1, 'Not connected')
-        return vpp_api.vac_write(bytes(buf), len(buf))
-
-    def read(self, timeout=None):
-        if not self.connected:
-            raise VppTransportShmemIOError(1, 'Not connected')
-        if timeout is None:
-            timeout = self.read_timeout
-        mem = ffi.new("char **")
-        size = ffi.new("int *")
-        rv = vpp_api.vac_read(mem, size, timeout)
-        if rv:
-            strerror = 'vac_read failed.  It is likely that VPP died.'
-            raise VppTransportShmemIOError(rv, strerror)
-        msg = bytes(ffi.buffer(mem[0], size[0]))
-        vpp_api.vac_free(mem[0])
-        return msg
