refactoring, test for java sockets