@Override
public SshDirectTcpipChannel getDirectTcpipConnection(InetSocketAddress local, InetSocketAddress remote)
throws IOException {
Session session = getSession();
ChannelDirectTCPIP directChannel;
try {
directChannel = (ChannelDirectTCPIP) session.openChannel("direct-tcpip");
directChannel.setHost(InetAddresses.toAddrString(remote.getAddress()));
directChannel.setPort(remote.getPort());
directChannel.setOrgIPAddress(InetAddresses.toAddrString(local.getAddress()));
directChannel.setOrgPort(local.getPort());
channelCount++;
directChannel.connect();
} catch (JSchException e) {
// TODO: Close session if it's failed??
channelCount--;
throw new IOException("Error opening direct-tcpip channel", e);
}