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((ServerSession) session);
proxies.put(proxy.getId(), proxy);
return new SshAgentServer() {
public String getId() {
return proxy.getId();
}
public void close() {
proxies.remove(proxy.getId());