update java sample code to use latest java-client