The getInvertedIn() output stream is buffered. If you want to actually send a small amount of data, you need to call flush() after writing to the stream.
Happy Easter, Guillaume Nodet 2014-04-20 5:15 GMT+02:00 Matthew DeVore <[email protected]>: > Hi, > > I'm trying to integrate Apache SSHD with my app and am running into a > strange issue. I can establish a connection and open a channel on a > subsystem, and then get the InputStreams and OutputStreams that correspond > to it. Data transferred over stderr and stdout seem to get transferred, but > anything written to stdin by the client is not getting to the server. The > client and server are both on localhost and using the SSHD library. > > I've written two unit tests to demonstrate this - one that passes > (connect-stdout-stderr) and one that deadlocks (connect-stdin). The code is > in Clojure. I'd be very grateful if someone could point me in the right > direction to fix the failing test. > > Thank you, > Matt > > *Application code*: > > https://github.com/matvore/hesokuri/blob/4d591abe22a3c24e8756b1316ef763be86b55225/src/hesokuri/ssh.clj > *Tests*: > > https://github.com/matvore/hesokuri/blob/4d591abe22a3c24e8756b1316ef763be86b55225/test/hesokuri/test_hesokuri/ssh.clj > > *Test log output:* > 19:41:38:matvore-macbookpro2:~/hesokuri$ lein test :only > hesokuri.test-hesokuri.ssh/connect-stdin > > lein test hesokuri.test-hesokuri.ssh > Apr 19, 2014 7:51:41 PM > org.apache.sshd.common.util.SecurityUtils$BouncyCastleRegistration run > 資訊: Trying to register BouncyCastle as a JCE provider > Apr 19, 2014 7:51:42 PM > org.apache.sshd.common.util.SecurityUtils$BouncyCastleRegistration run > 資訊: Registration succeeded > Apr 19, 2014 7:51:42 PM org.apache.sshd.client.session.ClientSessionImpl > <init> > 資訊: Client session created > Apr 19, 2014 7:51:42 PM org.apache.sshd.server.session.ServerSession <init> > 資訊: Server session created from /127.0.0.1:63408 > Apr 19, 2014 7:51:42 PM org.apache.sshd.client.session.ClientSessionImpl > readIdentification > 資訊: Server version string: SSH-2.0-SSHD-CORE-0.10.1 > Apr 19, 2014 7:51:42 PM org.apache.sshd.common.session.AbstractSession > negotiate > 資訊: Kex: server->client aes128-ctr hmac-sha2-256 none > Apr 19, 2014 7:51:42 PM org.apache.sshd.common.session.AbstractSession > negotiate > 資訊: Kex: client->server aes128-ctr hmac-sha2-256 none > Apr 19, 2014 7:51:42 PM org.apache.sshd.common.session.AbstractSession > negotiate > 資訊: Kex: server->client aes128-ctr hmac-sha2-256 none > Apr 19, 2014 7:51:42 PM org.apache.sshd.common.session.AbstractSession > negotiate > 資訊: Kex: client->server aes128-ctr hmac-sha2-256 none > Apr 19, 2014 7:51:43 PM > org.apache.sshd.server.session.ServerUserAuthService process > 資訊: Session hesokuri_user@/127.0.0.1:63408 authenticated > Apr 19, 2014 7:51:43 PM clojure.tools.logging$eval532$fn__538 invoke > 資訊: wait on promise... > Apr 19, 2014 7:51:43 PM clojure.tools.logging$eval532$fn__538 invoke > 資訊: read line... > *(deadlock here)* >
