Search in sources :

Example 1 with SinkChannel

use of java.nio.channels.Pipe.SinkChannel in project jeromq by zeromq.

the class PollTest method testPollPipe.

@Test(timeout = 1000)
public void testPollPipe() throws IOException {
    Pipe pipe = Pipe.open();
    assertThat(pipe, notNullValue());
    SinkChannel sink = pipe.sink();
    assertThat(sink, notNullValue());
    sink.configureBlocking(false);
    SourceChannel source = pipe.source();
    assertThat(source, notNullValue());
    source.configureBlocking(false);
    try {
        assertPoller(source, sink, sink::write, source::read);
    } finally {
        sink.close();
        source.close();
    }
}
Also used : SourceChannel(java.nio.channels.Pipe.SourceChannel) Pipe(java.nio.channels.Pipe) SinkChannel(java.nio.channels.Pipe.SinkChannel) Test(org.junit.Test)

Example 2 with SinkChannel

use of java.nio.channels.Pipe.SinkChannel in project j2objc by google.

the class PipeTest method test_sink.

/**
 * @tests java.nio.channels.Pipe#sink()
 */
public void test_sink() throws IOException {
    Pipe pipe = Pipe.open();
    SinkChannel sink = pipe.sink();
    assertTrue(sink.isBlocking());
}
Also used : Pipe(java.nio.channels.Pipe) SinkChannel(java.nio.channels.Pipe.SinkChannel)

Example 3 with SinkChannel

use of java.nio.channels.Pipe.SinkChannel in project robovm by robovm.

the class PipeTest method test_sink.

/**
	 * @tests java.nio.channels.Pipe#sink()
	 */
public void test_sink() throws IOException {
    Pipe pipe = Pipe.open();
    SinkChannel sink = pipe.sink();
    assertTrue(sink.isBlocking());
}
Also used : Pipe(java.nio.channels.Pipe) SinkChannel(java.nio.channels.Pipe.SinkChannel)

Example 4 with SinkChannel

use of java.nio.channels.Pipe.SinkChannel in project robovm by robovm.

the class SSLEngineTest method prepareEngines.

void prepareEngines() throws IOException {
    Pipe clientSendPipe = Pipe.open();
    Pipe serverSendPipe = Pipe.open();
    SinkChannel clientSink = clientSendPipe.sink();
    SourceChannel serverSource = clientSendPipe.source();
    SinkChannel serverSink = serverSendPipe.sink();
    SourceChannel clientSource = serverSendPipe.source();
    clientEngine = new HandshakeHandler(true, clientSource, clientSink);
    serverEngine = new HandshakeHandler(false, serverSource, serverSink);
}
Also used : SourceChannel(java.nio.channels.Pipe.SourceChannel) Pipe(java.nio.channels.Pipe) SinkChannel(java.nio.channels.Pipe.SinkChannel)

Aggregations

Pipe (java.nio.channels.Pipe)4 SinkChannel (java.nio.channels.Pipe.SinkChannel)4 SourceChannel (java.nio.channels.Pipe.SourceChannel)2 Test (org.junit.Test)1