Skip to content

Instantly share code, notes, and snippets.

@tristantarrant
Last active December 17, 2015 11:08
Show Gist options
  • Select an option

  • Save tristantarrant/5599555 to your computer and use it in GitHub Desktop.

Select an option

Save tristantarrant/5599555 to your computer and use it in GitHub Desktop.
An Infinispan Hot Rod client using SSL.
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