int forwardedPort = getFreePort();
SshdSocketAddress local = new SshdSocketAddress("", forwardedPort);
SshdSocketAddress remote = new SshdSocketAddress("localhost", echoPort);
ChannelDirectTcpip channel = session.createDirectTcpipChannel(local, remote);
channel.open().await();
channel.getInvertedIn().write("Hello".getBytes());
channel.getInvertedIn().flush();
byte[] buf = new byte[1024];
int n = channel.getInvertedOut().read(buf);
String res = new String(buf, 0, n);
assertEquals("Hello", res);
channel.close(false);
session.close(false).await();
}