@Test public void resetAcceptSessionShouldCloseSessions() throws Throwable { final AtomicBoolean acceptorSessionClosed = new AtomicBoolean(); final AtomicBoolean connectorSessionClosed = new AtomicBoolean(); NamedPipeAcceptorImpl acceptor = new NamedPipeAcceptorImpl(); acceptor.setHandler(new IoHandlerAdapter() { @Override public void sessionClosed(IoSession session) throws Exception { acceptorSessionClosed.set(true); } }); NamedPipeAddress localAddress = new NamedPipeAddress("accept"); acceptor.bind(localAddress); NamedPipeConnectorImpl connector = new NamedPipeConnectorImpl(); connector.setNamedPipeAcceptor(acceptor); connector.setHandler(new IoHandlerAdapter() { @Override public void sessionClosed(IoSession session) throws Exception { connectorSessionClosed.set(true); } }); NamedPipeAddress remoteAddress = new NamedPipeAddress("accept"); ConnectFuture connectFuture = connector.connect(remoteAddress); connectFuture.awaitUninterruptibly(); NamedPipeSession connectSession = (NamedPipeSession)connectFuture.getSession(); NamedPipeSession acceptSession = connectSession.getRemoteSession(); assertFalse(acceptorSessionClosed.get()); assertFalse(connectorSessionClosed.get()); assertNotNull(acceptSession.getRemoteSession()); acceptSession.setRemoteSession(null); assertNull(connectSession.getRemoteSession()); assertNull(acceptSession.getRemoteSession()); assertTrue(acceptorSessionClosed.get()); assertTrue(connectorSessionClosed.get()); }
public void setNamedPipeAcceptor(Ref<NamedPipeAcceptorImpl> acceptorRef) { this.acceptorRef = acceptorRef; }
NamedPipeConnectorImpl extends AbstractIoConnectorEx implements NamedPipeService { public void setNamedPipeAcceptor(Ref<NamedPipeAcceptorImpl> acceptorRef) { this.acceptorRef = acceptorRef; } }
NamedPipeConnectorImpl extends AbstractIoConnectorEx implements NamedPipeService { public void setNamedPipeAcceptor(Ref<NamedPipeAcceptorImpl> acceptorRef) { this.acceptorRef = acceptorRef; } NamedPipeConnectorImpl();  NamedPipeConnectorImpl(Executor executor); }
NamedPipeConnectorImpl extends AbstractIoConnectorEx implements NamedPipeService { public void setNamedPipeAcceptor(Ref<NamedPipeAcceptorImpl> acceptorRef) { this.acceptorRef = acceptorRef; } NamedPipeConnectorImpl();  NamedPipeConnectorImpl(Executor executor); void setNamedPipeAcceptor(Ref<NamedPipeAcceptorImpl> acceptorRef); @Override TransportMetadata getTransportMetadata(); }
NamedPipeConnectorImpl extends AbstractIoConnectorEx implements NamedPipeService { public void setNamedPipeAcceptor(Ref<NamedPipeAcceptorImpl> acceptorRef) { this.acceptorRef = acceptorRef; } NamedPipeConnectorImpl();  NamedPipeConnectorImpl(Executor executor); void setNamedPipeAcceptor(Ref<NamedPipeAcceptorImpl> acceptorRef); @Override TransportMetadata getTransportMetadata();  }