refactored test client and server