use of org.zeromq.ZPoller.EventsHandler in project jeromq by zeromq.
the class TestZPoller method testUseNull.
@Test
public void testUseNull() throws IOException {
ZPoller poller = new ZPoller(new ZStar.VerySimpleSelectorCreator().create());
SelectableChannel channel = null;
// ctx.createSocket(ZMQ.SUB);
Socket socket = null;
boolean rc = false;
rc = poller.register(socket, ZPoller.IN);
Assert.assertFalse("Registering a null socket was successful", rc);
rc = poller.register(channel, ZPoller.OUT);
Assert.assertFalse("Registering a null channel was successful", rc);
int events = poller.poll(10);
Assert.assertEquals("reading event on without sockets", 0, events);
rc = poller.isReadable(socket);
Assert.assertFalse("checking read event on a null socket was successful", rc);
rc = poller.writable(socket);
Assert.assertFalse("checking write event on a null socket was successful", rc);
rc = poller.readable(channel);
Assert.assertFalse("checking read event on a null channel was successful", rc);
rc = poller.isWritable(channel);
Assert.assertFalse("checking write event on a null channel was successful", rc);
EventsHandler global = null;
poller.setGlobalHandler(global);
EventsHandler handler = null;
rc = poller.register(socket, handler, ZPoller.ERR);
Assert.assertFalse("Register with handler on a null socket was successful", rc);
rc = poller.register(channel, ZPoller.ERR);
Assert.assertFalse("Register with handler on a null channel was successful", rc);
events = poller.poll(10);
Assert.assertEquals("reading event with events handlers without sockets", 0, events);
poller.close();
}
Aggregations