[java] add simple tests for public-key encryption