java part redone, now can connect to the socket.