public ForwardingSocketChannel createChannel(String hostToConnect,
int portToConnect, Socket socket)
throws ForwardingConfigurationException {
try {
ForwardingSocketChannel channel = createForwardingSocketChannel(ForwardingSocketChannel.REMOTE_FORWARDING_CHANNEL,
hostToConnect, portToConnect,
/*( (InetSocketAddress) socket.getRemoteSocketAddress()).getAddress()
.getHostAddress(),
( (InetSocketAddress) socket.getRemoteSocketAddress())
.getPort()*/
socket.getInetAddress().getHostAddress(), socket.getPort());
channel.bindSocket(socket);
return channel;
} catch (IOException ex) {
throw new ForwardingConfigurationException(ex.getMessage());
}