Set<ListenerEndpoint> endpoints = ioreactor.getEndpoints();
Assert.assertNotNull(endpoints);
Assert.assertEquals(0, endpoints.size());
ListenerEndpoint endpoint1 = ioreactor.listen(new InetSocketAddress(0));
endpoint1.waitFor();
ListenerEndpoint endpoint2 = ioreactor.listen(new InetSocketAddress(0));
endpoint2.waitFor();
int port = ((InetSocketAddress) endpoint2.getAddress()).getPort();
endpoints = ioreactor.getEndpoints();
Assert.assertNotNull(endpoints);
Assert.assertEquals(2, endpoints.size());
endpoint1.close();
endpoints = ioreactor.getEndpoints();
Assert.assertNotNull(endpoints);
Assert.assertEquals(1, endpoints.size());
ListenerEndpoint endpoint = endpoints.iterator().next();
Assert.assertEquals(port, ((InetSocketAddress) endpoint.getAddress()).getPort());
ioreactor.shutdown(1000);
t.join(1000);
Assert.assertEquals(IOReactorStatus.SHUT_DOWN, ioreactor.getStatus());