Replaced py4j with sockets