Rewrite the client as java