buffer.putBoolean(true);
buffer.putString(remote.getHostName());
buffer.putInt(remote.getPort());
Buffer result = session.request(buffer);
if (result == null) {
throw new SshException("Tcpip forwarding request denied by server");
}
int port = result.getInt();
// TODO: Is it really safe to only store the local address after the request ?
remoteToLocal.put(port, local);
return new SshdSocketAddress(remote.getHostName(), port);