For any Clojure var, you will use Clojure.var() to get a reference to it, then invoke() on it. For literals like the message, you can use either Clojure.read() to read Clojure data from a string, or use constructor functions like hash-map. with-open is a macro but in this case, it's basically replicating what you can do with try-with-resources in Java so you don't really need it. -> will need to be unrolled here or you could put more of this into a Clojure function and just invoke it.
I haven't compiled this but you'll end up with something like:
```
private static final IFn require = Clojure.var("clojure.core", "require");
private static final IFn doall = Clojure.var("clojure.core", "doall");
private static final Object portKW = Clojure.read(":port");
private static final Object opKW = Clojure.read(":op");
private static final Object codeKW = Clojure.read(":code");
private static final IFn connect;
private static final IFn client;
private static final IFn message;
static {
require.invoke(Clojure.read("nrepl.core"));
connect = Clojure.var("nrepl.core", "connect");
client = Clojure.var("nrepl.core", "client");
message = Clojure.var("nrepl.core", "message");
}
public Object getConnection(int port) {
return connect.invoke(portKW, port);
}
public Object getClient(Object conn, int timeout) {
return client.invoke(conn, timeout);
}
public Object send(Object client, Object message) {
Object result = message.invoke(client, message);
return doall.invoke(result);
}
```
then
```
try (Object conn = getConnection(59258)) {
Object client = getClient(conn, 1000);
Object result = send(client, Map.of(opKW, "eval", codeKW, "(time (reduce + (range 1e6)))"));
// result here is a map, do what you want with it
}
```