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