Removed some unused imports in library code

This patch removes the 'io', 'socket' and 'zmq' imports from handlers.py and
the 'json' import from factory.py.

Change-Id: I9c12ee6f2b4977c9445f992907d838cc494db408