[ 
https://issues.apache.org/jira/browse/SSHD-433?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jay Guidos reopened SSHD-433:
-----------------------------

As far as I can tell this problem remains in 0.14.0.  I upgraded to this 
version and re-ran my failing unit test, which basically just opens and then 
closes a remote tunnel.  One of the final assertions is confirming the remote 
port is closed.  Here is the output of that test:

{noformat}
/appl/jdk1.7.0_17/bin/java 
-agentlib:jdwp=transport=dt_socket,address=127.0.0.1:53044,suspend=y,server=n 
-ea 
-javaagent:/home/bidsjagu/tools/idea-IU-141.177.4/plugins/Groovy/lib/agent/gragent.jar
 -Dfile.encoding=UTF-8 -classpath 
/home/bidsjagu/tools/idea-IU-141.177.4/lib/idea_rt.jar:/home/bidsjagu/tools/idea-IU-141.177.4/plugins/junit/lib/junit-rt.jar:/appl/jdk1.7.0_17/jre/lib/rt.jar:/appl/jdk1.7.0_17/jre/lib/management-agent.jar:/appl/jdk1.7.0_17/jre/lib/jsse.jar:/appl/jdk1.7.0_17/jre/lib/javaws.jar:/appl/jdk1.7.0_17/jre/lib/jce.jar:/appl/jdk1.7.0_17/jre/lib/plugin.jar:/appl/jdk1.7.0_17/jre/lib/deploy.jar:/appl/jdk1.7.0_17/jre/lib/jfr.jar:/appl/jdk1.7.0_17/jre/lib/jfxrt.jar:/appl/jdk1.7.0_17/jre/lib/charsets.jar:/appl/jdk1.7.0_17/jre/lib/resources.jar:/appl/jdk1.7.0_17/jre/lib/ext/sunpkcs11.jar:/appl/jdk1.7.0_17/jre/lib/ext/zipfs.jar:/appl/jdk1.7.0_17/jre/lib/ext/dnsns.jar:/appl/jdk1.7.0_17/jre/lib/ext/sunec.jar:/appl/jdk1.7.0_17/jre/lib/ext/sunjce_provider.jar:/appl/jdk1.7.0_17/jre/lib/ext/localedata.jar:/home/bidsjagu/java/opstools/bidsCommon/trunk/SSH/target/test-classes:/home/bidsjagu/java/opstools/bidsCommon/trunk/SSH/target/classes:/home/bidsjagu/java/opstools/bidsCommon/trunk/BidsUtils/target/classes:/home/bidsjagu/java/opstools/bidsCommon/trunk/SSHConfig/target/classes:/home/bidsjagu/.m2/repository/com/jcraft/jsch/0.1.51/jsch-0.1.51.jar:/home/bidsjagu/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar:/home/bidsjagu/.m2/repository/org/slf4j/slf4j-log4j12/1.7.7/slf4j-log4j12-1.7.7.jar:/home/bidsjagu/.m2/repository/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar:/home/bidsjagu/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar:/home/bidsjagu/java/opstools/bidsCommon/trunk/TestHelp/target/classes:/home/bidsjagu/.m2/repository/org/codehaus/groovy/groovy-all/2.4.1/groovy-all-2.4.1.jar:/home/bidsjagu/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/home/bidsjagu/.m2/repository/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar:/home/bidsjagu/.m2/repository/com/cyrusinnovation/mockito-groovy-support/1.3/mockito-groovy-support-1.3.jar:/home/bidsjagu/.m2/repository/org/mockito/mockito-all/1.9.5/mockito-all-1.9.5.jar:/home/bidsjagu/.m2/repository/junit/junit/4.11/junit-4.11.jar:/home/bidsjagu/.m2/repository/org/powermock/powermock-module-junit4-rule-agent/1.6.1/powermock-module-junit4-rule-agent-1.6.1.jar:/home/bidsjagu/.m2/repository/org/powermock/powermock-module-javaagent/1.6.1/powermock-module-javaagent-1.6.1.jar:/home/bidsjagu/.m2/repository/org/powermock/powermock-api-mockito/1.6.1/powermock-api-mockito-1.6.1.jar:/home/bidsjagu/.m2/repository/org/powermock/powermock-api-support/1.6.1/powermock-api-support-1.6.1.jar:/home/bidsjagu/.m2/repository/org/powermock/powermock-core/1.6.1/powermock-core-1.6.1.jar:/home/bidsjagu/.m2/repository/org/powermock/powermock-reflect/1.6.1/powermock-reflect-1.6.1.jar:/home/bidsjagu/.m2/repository/org/objenesis/objenesis/2.1/objenesis-2.1.jar:/home/bidsjagu/.m2/repository/org/javassist/javassist/3.18.2-GA/javassist-3.18.2-GA.jar:/home/bidsjagu/.m2/repository/org/powermock/powermock-module-junit4/1.6.1/powermock-module-junit4-1.6.1.jar:/home/bidsjagu/.m2/repository/org/powermock/powermock-module-junit4-common/1.6.1/powermock-module-junit4-common-1.6.1.jar:/home/bidsjagu/java/opstools/bidsCommon/trunk/MockSSHDServer/target/classes:/home/bidsjagu/.m2/repository/org/apache/sshd/sshd-core/0.14.0/sshd-core-0.14.0.jar
 com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 
com.bids.ssh.jsch.JSchSSHConnectionTests,makeRemoteTunnel
Connected to the target VM, address: '127.0.0.1:53044', transport: 'socket'
12:35:42,401 INFO  [main] SecurityUtils - BouncyCastle not registered, using 
the default JCE provider
12:35:42,975 DEBUG [main] Nio2Acceptor - Creating Nio2Acceptor
12:35:42,978 DEBUG [main] Nio2Acceptor - Binding Nio2Acceptor to address 
0.0.0.0/0.0.0.0:2299
12:35:46,026 INFO  [main] BasicSSHEventManager - fireOnSSHConnecting [TST] SSH: 
myConnection
12:35:46,026 INFO  [main] JSchPasswordAuthSSHSessionFactory - Creating SSH 
Session using password authentication.  User : bidsjagu
12:35:46,034 DEBUG [main] JSchSessionFactory - Known hosts file  missing for 
myConnection, strict host key checking disabled
12:35:46,035 DEBUG [main] SSHConnection - myConnection: Connecting SSH session 
to bidsjagu@localhost:2299
12:35:46,036 DEBUG [main] JSCH_LOGGER - Connecting to localhost port 2299
12:35:46,044 DEBUG [main] JSCH_LOGGER - Connection established
12:35:46,050 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] Nio2Session - 
Creating IoSession on /127.0.0.1:2299 from /127.0.0.1:15614
12:35:46,058 INFO  [sshd-SshServer[453ef5b1]-nio2-thread-1] ServerSession - 
Server session created from /127.0.0.1:15614
12:35:46,058 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] Nio2Session - 
Writing 26 bytes
12:35:46,060 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] Nio2Session - 
Finished writing
12:35:46,060 DEBUG [main] JSCH_LOGGER - Remote version string: 
SSH-2.0-SSHD-CORE-0.14.0
12:35:46,060 DEBUG [main] JSCH_LOGGER - Local version string: 
SSH-2.0-JSCH-0.1.51
12:35:46,061 DEBUG [main] JSCH_LOGGER - CheckCiphers: 
aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
12:35:46,061 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] Nio2Session - Read 
20 bytes
12:35:46,062 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] ServerSession - 
Client version string: SSH-2.0-JSCH-0.1.51
12:35:46,063 INFO  [sshd-SshServer[453ef5b1]-nio2-thread-1] 
SimpleGeneratorHostKeyProvider - Generating host key...
12:35:46,068 DEBUG [main] JSCH_LOGGER - CheckKexes: diffie-hellman-group14-sha1
12:35:46,074 DEBUG [main] JSCH_LOGGER - diffie-hellman-group14-sha1 is not 
available.
12:35:46,075 DEBUG [main] JSCH_LOGGER - SSH_MSG_KEXINIT sent
12:35:46,086 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] ServerSession - 
Send SSH_MSG_KEXINIT
12:35:46,086 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] Nio2Session - 
Writing 608 bytes
12:35:46,087 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] Nio2Session - 
Finished writing
12:35:46,087 DEBUG [main] JSCH_LOGGER - SSH_MSG_KEXINIT received
12:35:46,087 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] Nio2Session - Read 
424 bytes
12:35:46,087 DEBUG [main] JSCH_LOGGER - kex: server: 
diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1
12:35:46,088 DEBUG [main] JSCH_LOGGER - kex: server: ssh-dss
12:35:46,088 DEBUG [main] JSCH_LOGGER - kex: server: 
aes128-ctr,aes192-ctr,aes256-ctr,arcfour128,arcfour256,aes128-cbc,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc
12:35:46,089 DEBUG [main] JSCH_LOGGER - kex: server: 
aes128-ctr,aes192-ctr,aes256-ctr,arcfour128,arcfour256,aes128-cbc,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc
12:35:46,090 DEBUG [main] JSCH_LOGGER - kex: server: 
hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96
12:35:46,090 DEBUG [main] JSCH_LOGGER - kex: server: 
hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96
12:35:46,091 DEBUG [main] JSCH_LOGGER - kex: server: none
12:35:46,091 DEBUG [main] JSCH_LOGGER - kex: server: none
12:35:46,091 DEBUG [main] JSCH_LOGGER - kex: server: 
12:35:46,092 DEBUG [main] JSCH_LOGGER - kex: server: 
12:35:46,092 DEBUG [main] JSCH_LOGGER - kex: client: 
diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1
12:35:46,093 DEBUG [main] JSCH_LOGGER - kex: client: ssh-rsa,ssh-dss
12:35:46,093 DEBUG [main] JSCH_LOGGER - kex: client: 
aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc
12:35:46,093 DEBUG [main] JSCH_LOGGER - kex: client: 
aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc
12:35:46,087 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] ServerSession - 
Received SSH_MSG_KEXINIT
12:35:46,094 DEBUG [main] JSCH_LOGGER - kex: client: 
hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
12:35:46,095 DEBUG [main] JSCH_LOGGER - kex: client: 
hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
12:35:46,095 DEBUG [main] JSCH_LOGGER - kex: client: none
12:35:46,095 DEBUG [main] JSCH_LOGGER - kex: client: none
12:35:46,096 DEBUG [main] JSCH_LOGGER - kex: client: 
12:35:46,096 DEBUG [main] JSCH_LOGGER - kex: client: 
12:35:46,095 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] ServerSession - 
Kex: server->client aes128-ctr hmac-md5 none
12:35:46,097 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] ServerSession - 
Kex: client->server aes128-ctr hmac-md5 none
12:35:46,096 DEBUG [main] JSCH_LOGGER - kex: server->client aes128-ctr hmac-md5 
none
12:35:46,098 DEBUG [main] JSCH_LOGGER - kex: client->server aes128-ctr hmac-md5 
none
12:35:46,106 DEBUG [main] JSCH_LOGGER - SSH_MSG_KEXDH_INIT sent
12:35:46,106 DEBUG [main] JSCH_LOGGER - expecting SSH_MSG_KEXDH_REPLY
12:35:46,107 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] Nio2Session - Read 
152 bytes
12:35:46,107 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] DHG1 - Received 
SSH_MSG_KEXDH_INIT
12:35:46,116 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] DHG1 - K_S:  00 00 
00 07 73 73 68 2d 64 73 73 00 00 00 81 00 fd 7f 53 81 1d 75 12 29 52 df 4a 9c 
2e ec e4 e7 f6 11 b7 52 3c ef 44 00 c3 1e 3f 80 b6 51 26 69 45 5d 40 22 51 fb 
59 3d 8d 58 fa bf c5 f5 ba 30 f6 cb 9b 55 6c d7 81 3b 80 1d 34 6f f2 66 60 b7 
6b 99 50 a5 a4 9f 9f e8 04 7b 10 22 c2 4f bb a9 d7 fe b7 c6 1b f8 3b 57 e7 c6 
a8 a6 15 0f 04 fb 83 f6 d3 c5 1e c3 02 35 54 13 5a 16 91 32 f6 75 f3 ae 2b 61 
d7 2a ef f2 22 03 19 9d d1 48 01 c7 00 00 00 15 00 97 60 50 8f 15 23 0b cc b2 
92 b9 82 a2 eb 84 0b f0 58 1c f5 00 00 00 81 00 f7 e1 a0 85 d6 9b 3d de cb bc 
ab 5c 36 b8 57 b9 79 94 af bb fa 3a ea 82 f9 57 4c 0b 3d 07 82 67 51 59 57 8e 
ba d4 59 4f e6 71 07 10 81 80 b4 49 16 71 23 e8 4c 28 16 13 b7 cf 09 32 8c c8 
a6 e1 3c 16 7a 8b 54 7c 8d 28 e0 a3 ae 1e 2b b3 a6 75 91 6e a3 7f 0b fa 21 35 
62 f1 fb 62 7a 01 24 3b cc a4 f1 be a8 51 90 89 a8 83 df e1 5a e5 9f 06 92 8b 
66 5e 80 7b 55 25 64 01 4c 3b fe cf 49 2a 00 00 00 80 20 82 68 f7 45 4c 07 c0 
e5 58 fd b1 5a 90 59 71 28 7f c0 47 7e b0 e7 5a e2 4d 6d 72 54 27 de 24 ef 90 
01 a6 d0 69 8b a8 f5 d0 b0 67 6a 44 9a b3 d8 07 e7 fb 8e ad b6 6c 2a a8 d9 8e 
4b 76 2e d6 a8 10 c9 d9 41 61 48 40 1c 45 bd 15 7f 1a 46 6d ab 45 e7 81 76 2c 
29 22 18 07 d8 cf 78 41 38 b5 8e 86 24 d3 76 4a 5c 23 8f 52 21 41 83 1a 29 b3 
22 f7 4b 62 4f 24 a6 75 64 55 fe 39 fe 5a 42 a1
12:35:46,119 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] DHG1 - f:    12 31 
81 a2 75 88 45 f6 f7 c9 e1 8d 7a 63 ae 51 7c 52 65 5e 15 f7 ce 98 07 35 f7 40 
6e 82 cb 1a af 0e 3b 8c d5 52 7d 7e c5 f7 8a 5f 78 a4 f9 f1 cd e0 c8 cd b0 2a 
a5 29 49 e9 64 af 54 ef 6e a7 36 a4 81 ae 9e 10 bd 3e 17 d8 0d ca 32 98 35 cb 
d6 96 f6 90 1d bd fb 3c 40 0a eb 90 8a 97 ea 35 7e f9 36 ce 30 0e ec 64 b8 54 
46 39 83 ef 50 a7 1c ca 2f 52 14 51 35 df 53 be 15 d2 f1 ec d7 95
12:35:46,120 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] DHG1 - sigH: 00 00 
00 07 73 73 68 2d 64 73 73 00 00 00 28 54 34 2a 1d c8 01 5b 21 cd 9c 04 31 d3 
7b 8e 6a ed a1 80 29 60 5d c0 fe 9d c2 26 8a 87 68 16 b9 7e 8e 66 f4 3e fd 8a f0
12:35:46,120 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] DHG1 - Send 
SSH_MSG_KEXDH_REPLY
12:35:46,120 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] Nio2Session - 
Writing 648 bytes
12:35:46,121 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] Nio2Session - 
Finished writing
12:35:46,121 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] ServerSession - 
Send SSH_MSG_NEWKEYS
12:35:46,121 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] Nio2Session - 
Writing 16 bytes
12:35:46,122 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-1] Nio2Session - 
Finished writing
12:35:46,130 DEBUG [main] JSCH_LOGGER - ssh_dss_verify: signature true
12:35:46,133 WARN  [main] JSCH_LOGGER - Permanently added 'localhost' (DSA) to 
the list of known hosts.
12:35:46,133 DEBUG [main] JSCH_LOGGER - SSH_MSG_NEWKEYS sent
12:35:46,133 DEBUG [main] JSCH_LOGGER - SSH_MSG_NEWKEYS received
12:35:46,134 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-2] Nio2Session - Read 
16 bytes
12:35:46,135 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-2] ServerSession - 
Received SSH_MSG_NEWKEYS
12:35:46,139 DEBUG [main] JSCH_LOGGER - SSH_MSG_SERVICE_REQUEST sent
12:35:46,140 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-3] Nio2Session - Read 
64 bytes
12:35:46,140 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-3] ServerSession - 
Received SSH_MSG_SERVICE_REQUEST 'ssh-userauth'
12:35:46,143 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-3] 
ServerUserAuthService - Authorized authentication methods: 
password,keyboard-interactive,publickey
12:35:46,143 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-3] ServerSession - 
Accepted service ssh-userauth
12:35:46,144 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-3] Nio2Session - 
Writing 64 bytes
12:35:46,144 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-3] Nio2Session - 
Finished writing
12:35:46,144 DEBUG [main] JSCH_LOGGER - SSH_MSG_SERVICE_ACCEPT received
12:35:46,145 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-4] Nio2Session - Read 
80 bytes
12:35:46,146 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-4] 
ServerUserAuthService - Received SSH_MSG_USERAUTH_REQUEST
12:35:46,146 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-4] 
ServerUserAuthService - Authenticating user 'bidsjagu' with service 
'ssh-connection' and method 'none'
12:35:46,147 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-4] 
ServerUserAuthService - Authentication failed
12:35:46,147 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-4] Nio2Session - 
Writing 96 bytes
12:35:46,147 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-4] Nio2Session - 
Finished writing
12:35:46,148 DEBUG [main] JSCH_LOGGER - Authentications that can continue: 
publickey,keyboard-interactive,password
12:35:46,148 DEBUG [main] JSCH_LOGGER - Next authentication method: publickey
12:35:46,149 DEBUG [main] JSCH_LOGGER - Authentications that can continue: 
keyboard-interactive,password
12:35:46,149 DEBUG [main] JSCH_LOGGER - Next authentication method: 
keyboard-interactive
12:35:46,151 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-5] Nio2Session - Read 
112 bytes
12:35:46,152 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-5] 
ServerUserAuthService - Received SSH_MSG_USERAUTH_REQUEST
12:35:46,152 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-5] 
ServerUserAuthService - Authenticating user 'bidsjagu' with service 
'ssh-connection' and method 'keyboard-interactive'
12:35:46,154 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-5] Nio2Session - 
Writing 112 bytes
12:35:46,154 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-5] Nio2Session - 
Finished writing
12:35:46,154 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-5] 
ServerUserAuthService - Authentication not finished
12:35:46,155 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-5] Nio2Session - Read 
64 bytes
12:35:46,155 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-5] 
ServerUserAuthService - Received authentication message 61
12:35:46,163 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-5] 
ServerUserAuthService - Authentication succeeded
12:35:46,164 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-5] Nio2Session - 
Writing 48 bytes
12:35:46,164 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-5] Nio2Session - 
Finished writing
12:35:46,164 DEBUG [main] JSCH_LOGGER - Authentication succeeded 
(keyboard-interactive).
12:35:46,165 DEBUG [main] JSchSSHConnection - JSch session is connected to host 
localhost: com.jcraft.jsch.Session@4394213a
12:35:46,165 INFO  [main] BasicSSHEventManager - fireOnSSHConnected [TST] : 
bidsjagu on SSH: myConnection
12:35:46,165 INFO  [main] SSHConnection - myConnection: SSH session to 
bidsjagu@localhost:2299 has connected
12:35:46,169 INFO  [sshd-SshServer[453ef5b1]-nio2-thread-5] 
ServerUserAuthService - Session bidsjagu@/127.0.0.1:15614 authenticated
12:35:46,183 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-6] Nio2Session - Read 
80 bytes
12:35:46,183 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-6] 
ServerConnectionService - Received SSH_MSG_GLOBAL_REQUEST tcpip-forward
12:35:46,186 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-6] Nio2Acceptor - 
Creating Nio2Acceptor
12:35:46,187 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-6] Nio2Acceptor - 
Binding Nio2Acceptor to address /127.0.0.1:9402
12:35:46,188 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-6] Nio2Session - 
Writing 48 bytes
12:35:46,188 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-6] Nio2Session - 
Finished writing
12:35:46,188 INFO  [main] JSchSSHTunnel - myConnection:MockTunnel-> -R 
127.0.0.1:9402:127.0.0.1:9403
12:35:46,217 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-7] Nio2Session - 
Creating IoSession on /127.0.0.1:9402 from /127.0.0.1:22770
12:35:46,218 INFO  [main] JSchSSHTunnel - myConnection:MockTunnel-> -R 
127.0.0.1:9402:127.0.0.1:9403
12:35:46,218 INFO  [main] BasicSSHEventManager - fireOnSSHDisconnecting [TST] : 
bidsjagu on SSH: myConnection
12:35:46,219 DEBUG [main] SSHConnection - myConnection: Disconnecting SSH 
connection to bidsjagu@localhost:2299
12:35:46,219 DEBUG [main] JSCH_LOGGER - Disconnecting from localhost port 2299
12:35:46,220 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] Nio2Session - Read 
80 bytes
12:35:46,220 INFO  [main] SSHConnection - myConnection: SSH session to 
bidsjagu@localhost:2299 has disconnected
12:35:46,221 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] 
ServerConnectionService - Received SSH_MSG_GLOBAL_REQUEST cancel-tcpip-forward
12:35:46,220 DEBUG [Connect thread localhost session] JSCH_LOGGER - Caught an 
exception, leaving main loop due to Socket closed
12:35:46,221 INFO  [main] BasicSSHEventManager - fireOnSSHDisconnected [TST] : 
bidsjagu on SSH: myConnection
12:35:46,221 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] Nio2Session - 
Socket has been disconnected, closing IoSession now
12:35:46,380 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] Nio2Session - 
Closing Nio2Session[local=/127.0.0.1:2299, remote=/127.0.0.1:15614] immediately
12:35:46,380 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] ServerSession - 
Closing ServerSession[bidsjagu@/127.0.0.1:15614] immediately
12:35:56,579 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] 
ServerConnectionService - Closing 
ServerConnectionService[ServerSession[bidsjagu@/127.0.0.1:15614]] immediately
12:35:56,582 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] 
DefaultTcpipForwarder - Closing 
DefaultTcpipForwarder[ServerSession[bidsjagu@/127.0.0.1:15614]] immediately
12:35:56,584 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] Nio2Acceptor - 
Unbinding
12:35:56,584 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] Nio2Acceptor - 
Closing org.apache.sshd.common.io.nio2.Nio2Acceptor@1bdb2464 immediately
12:35:56,585 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] Nio2Acceptor - 
org.apache.sshd.common.io.nio2.Nio2Acceptor@1bdb2464 closed
12:35:56,585 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] 
DefaultTcpipForwarder - 
DefaultTcpipForwarder[ServerSession[bidsjagu@/127.0.0.1:15614]] closed
12:35:56,586 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] AgentForwardSupport 
- Closing AgentForwardSupport[ServerSession[bidsjagu@/127.0.0.1:15614]] 
immediately
12:35:56,586 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] AgentForwardSupport 
- AgentForwardSupport[ServerSession[bidsjagu@/127.0.0.1:15614]] closed
12:35:56,586 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] X11ForwardSupport - 
Closing org.apache.sshd.server.x11.X11ForwardSupport@58eff866 immediately
12:35:56,587 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] X11ForwardSupport - 
org.apache.sshd.server.x11.X11ForwardSupport@58eff866 closed
12:35:56,587 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] 
ServerConnectionService - 
ServerConnectionService[ServerSession[bidsjagu@/127.0.0.1:15614]] closed
12:35:56,588 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] Nio2Session - 
Nio2Session[local=/127.0.0.1:2299, remote=/127.0.0.1:15614] is already closed
12:35:56,588 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] ServerSession - 
ServerSession[bidsjagu@/127.0.0.1:15614] closed
12:35:56,588 DEBUG [sshd-SshServer[453ef5b1]-nio2-thread-8] Nio2Session - 
Nio2Session[local=/127.0.0.1:2299, remote=/127.0.0.1:15614] closed

java.lang.AssertionError: Tunnel port closed
Expected: is <false>
     but: was <true>
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.junit.Assert.assertThat(Assert.java:865)
        at org.junit.Assert$assertThat.callStatic(Unknown Source)
        at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:53)
        at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:191)
        at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:219)
        at 
com.bids.ssh.jsch.JSchSSHConnectionTests.makeRemoteTunnel(JSchSSHConnectionTests.groovy:229)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
        at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)

12:35:56,627 DEBUG [main] SshServer - Closing SshServer[453ef5b1] gracefully
12:35:56,631 DEBUG [main] Nio2Acceptor - Unbinding
12:35:56,631 DEBUG [main] Nio2Acceptor - Closing 
org.apache.sshd.common.io.nio2.Nio2Acceptor@25b27332 gracefully
12:35:56,632 DEBUG [main] Nio2Acceptor - 
org.apache.sshd.common.io.nio2.Nio2Acceptor@25b27332 closed
12:35:56,632 DEBUG [main] Nio2ServiceFactory - Closing 
org.apache.sshd.common.io.nio2.Nio2ServiceFactory@1d9eaef2 gracefully
12:35:56,635 DEBUG [main] Nio2ServiceFactory - 
org.apache.sshd.common.io.nio2.Nio2ServiceFactory@1d9eaef2 closed
12:35:56,636 DEBUG [main] SshServer - SshServer[453ef5b1] closed
Disconnected from the target VM, address: '127.0.0.1:53044', transport: 'socket'

Process finished with exit code 255

{noformat}

> Cannot close and then reopen a remote forward on the same port
> --------------------------------------------------------------
>
>                 Key: SSHD-433
>                 URL: https://issues.apache.org/jira/browse/SSHD-433
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 0.13.0
>            Reporter: Jay Guidos
>         Attachments: 
> 0001-SSHD-433-Cannot-close-and-then-reopen-a-remote-forwa.patch
>
>
> Opening a remote forwarding port works fine, but when it is closed SSHD fails 
> to unbind the socket, leaving the port open.
> While the SSHD process remains connected the remote port will remain open 
> forever, causing subsequent remote forwarding attempts to fail in this 
> session or any other) until the SSHD process terminates.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to