use of org.apache.sshd.agent.SshAgentServer in project karaf by apache.
the class KarafAgentFactory method createServer.
public SshAgentServer createServer(ConnectionService service) throws IOException {
Session session = service.getSession();
if (!(session instanceof ServerSession)) {
throw new IllegalStateException("The session used to create an agent server proxy must be a server session");
}
final AgentServerProxy proxy = new AgentServerProxy(service);
proxies.put(proxy.getId(), proxy);
return new SshAgentServer() {
public String getId() {
return proxy.getId();
}
@Override
public boolean isOpen() {
return proxy.isOpen();
}
public void close() throws IOException {
proxies.remove(proxy.getId());
proxy.close();
}
};
}
Aggregations