Last active
December 17, 2015 11:08
-
-
Save tristantarrant/5599555 to your computer and use it in GitHub Desktop.
An Infinispan Hot Rod client using SSL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.infinispan.client.hotrod.RemoteCache; | |
| import org.infinispan.client.hotrod.RemoteCacheManager; | |
| import org.infinispan.client.hotrod.configuration.ConfigurationBuilder; | |
| public class Client { | |
| public static void main(String[] args) { | |
| ClassLoader tccl = Thread.currentThread().getContextClassLoader(); | |
| ConfigurationBuilder builder = new ConfigurationBuilder(); | |
| builder | |
| .addServer() | |
| .host("127.0.0.1") | |
| .port(11222) | |
| .ssl() | |
| .enable() | |
| .keyStoreFileName(tccl.getResource("keystore.jks").getPath()) | |
| .keyStorePassword("secret".toCharArray()) | |
| .trustStoreFileName(tccl.getResource("keystore.jks").getPath()) | |
| .trustStorePassword("secret".toCharArray()); | |
| RemoteCacheManager rcm = new RemoteCacheManager(builder.build()); | |
| RemoteCache<String, String> cache = rcm.getCache("default"); | |
| cache.put("c", "c"); | |
| System.out.printf("c=%s\n", cache.get("c")); | |
| rcm.stop(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment