@Test public void readSuspendedAcceptedSessionShouldNotReceiveIoBuffersFromRemote() throws Throwable { NamedPipeAcceptorImpl acceptor = new NamedPipeAcceptorImpl(); final AtomicReference<IoBuffer> acceptorMessageReceived = new AtomicReference<>(); acceptor.setHandler(new IoHandlerAdapter() { @Override public void messageReceived(IoSession session, Object message) throws Exception { IoBuffer buf = (IoBuffer)message; acceptorMessageReceived.set(buf.duplicate()); } }); NamedPipeAddress localAddress = new NamedPipeAddress("accept"); acceptor.bind(localAddress); NamedPipeConnectorImpl connector = new NamedPipeConnectorImpl(); connector.setNamedPipeAcceptor(acceptor); connector.setHandler(new IoHandlerAdapter() { @Override public void messageReceived(IoSession session, Object message) throws Exception { IoBuffer buf = (IoBuffer)message; session.write(buf.duplicate()); } }); NamedPipeAddress remoteAddress = new NamedPipeAddress("accept"); ConnectFuture connectFuture = connector.connect(remoteAddress); connectFuture.awaitUninterruptibly(); IoSessionEx session = (IoSessionEx) connectFuture.getSession(); IoSessionEx remoteSession = ((NamedPipeSession)session).getRemoteSession(); remoteSession.suspendRead(); IoBufferAllocatorEx<?> allocator = session.getBufferAllocator(); WriteFuture writeFuture = session.write(allocator.wrap(ByteBuffer.wrap(ECHO_BYTES))); assertFalse(writeFuture.isWritten()); assertNull(acceptorMessageReceived.get()); remoteSession.resumeRead(); writeFuture.awaitUninterruptibly(); assertEquals(allocator.wrap(ByteBuffer.wrap(ECHO_BYTES)), acceptorMessageReceived.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();  }