public void run() {
while (true) {
try {
Socket forwardConnection;
ImmortalSocket reciever = listener.accept();
logger.info("New TunnelClient connected");
try {
logger.info("Connecting to server "
+ forwardAddress.getHostAddress() + ":"
+ forwardPort + " to forward the data");
forwardConnection = new Socket(forwardAddress, forwardPort);
logger.info("Connected");
} catch (IOException e) {
logger.warn("Error when connecting to the server"
+ " to forward the data, the new tunnel"
+ " connection has been closed", e);
reciever.close();
continue;
}
logger.info("Building tunnel");
new CopyThread(reciever.getInputStream(), forwardConnection
.getOutputStream()).start();
new CopyThread(forwardConnection.getInputStream(), reciever
.getOutputStream()).start();
logger.info("Tunnel built");
} catch (IOException e) {