throw new InvalidChannelException(
"Local display has not been set for X11 forwarding.");
}
try {
ByteArrayReader bar = new ByteArrayReader(requestData);
String originatingHost = bar.readString();
int originatingPort = (int) bar.readInt();
log.debug("Creating socket to " +
x11ForwardingConfiguration.getHostToConnect() + "/" +
x11ForwardingConfiguration.getPortToConnect());
Socket socket = new Socket(x11ForwardingConfiguration.getHostToConnect(),
x11ForwardingConfiguration.getPortToConnect());
// Create the channel adding it to the active channels
ForwardingSocketChannel channel = x11ForwardingConfiguration.createForwardingSocketChannel(channelType,
x11ForwardingConfiguration.getHostToConnect(),
x11ForwardingConfiguration.getPortToConnect(),
originatingHost, originatingPort);
channel.bindSocket(socket);
channel.addEventListener(x11ForwardingConfiguration.monitor);
return channel;
} catch (IOException ioe) {
throw new InvalidChannelException(ioe.getMessage());
}
}
if (channelType.equals(
ForwardingSocketChannel.REMOTE_FORWARDING_CHANNEL)) {
try {
ByteArrayReader bar = new ByteArrayReader(requestData);
String addressBound = bar.readString();
int portBound = (int) bar.readInt();
String originatingHost = bar.readString();
int originatingPort = (int) bar.readInt();
ForwardingConfiguration config = getRemoteForwardingByAddress(addressBound,
portBound);
Socket socket = new Socket(config.getHostToConnect(),
config.getPortToConnect());