SelectorManager sm = new SelectorManager();
sm.setThreadPool(tp);
sm.setThreadName("Client Selector Manager");
sm.doStart();
ControlClientProtocolStack clientStack = new ControlClientProtocolStack();
clientStack.setClassLoader(Thread.currentThread().getContextClassLoader());
clientStack.setThreadPool(tp);
clientStack.setClockPool(cp);
clientStack.setSelectorManager(sm);
SocketProtocol sp = new SocketProtocol();
sp.setTimeout(1000 * 1000); //todo reset to 10s
sp.setInterface(new InetSocketAddress(ssa.getConnectURI().getHost(), 0));
sp.setAddress(new InetSocketAddress(ssa.getConnectURI().getHost(), ssa.getConnectURI().getPort()));
sp.setSelectorManager(sm);
clientStack.push(sp);
ControlClientProtocol ccp = new ControlClientProtocol();
ccp.setTimeout(1000 * 1000); //todo set to 10s
clientStack.push(ccp);
clientStack.setup();
Thread.sleep(5 * 1000); //todo delete
clientStack.sendDown(getPlainPacket());
clientStack.sendDown(getPlainPacket());
clientStack.sendDown(getPlainPacket());
Thread.sleep(5 * 1000); //todo back to 5s
clientStack.drain();
shutdownLatch.release();
sm.doStop();