}
}
public ClientChannel createChannel(String type) throws Exception {
// TODO: use NamedFactory to create channel
AbstractClientChannel channel;
if (ClientChannel.CHANNEL_SHELL.equals(type)) {
channel = new ChannelShell();
} else if (ClientChannel.CHANNEL_EXEC.equals(type)) {
channel = new ChannelExec();
} else {
throw new IllegalArgumentException("Unsupported channel type " + type);
}
int id = ++nextChannelId;
channel.init(this, id);
channels.put(id, channel);
return channel;
}