So, here's the situation:
I would like to use the sshj library to connect to a host which automatically runs a script on connection. Let's say the script merely logs whatever json formated input it receives. In the terminal I can run something like:
echo '{ "name" : "Hubert", "status" : "alive" }' | ssh -i ~/.ssh/id_ed25519 [email protected]
and upon connection the host would log the info { "name" : "Hubert", "status" : "alive" }.
What would an (equivalent) implementation of the above command look like in sshj?
Okay, I am not 100% sure whether all I do in the following code is entirely necessary, but it works for me: