Search in sources :

Example 1 with IChannelDisconnectEvent

use of org.eclipse.ecf.datashare.events.IChannelDisconnectEvent in project ecf by eclipse.

the class NIODatashareTest method testChannelDisconnectEvent.

public void testChannelDisconnectEvent() throws Exception {
    final ID[] eventIds = new ID[2];
    channelA = createChannel(channelContainerA, new IChannelListener() {

        public void handleChannelEvent(IChannelEvent e) {
            if (e instanceof IChannelDisconnectEvent) {
                IChannelDisconnectEvent event = (IChannelDisconnectEvent) e;
                eventIds[0] = event.getChannelID();
                eventIds[1] = event.getTargetID();
            }
        }
    });
    containerA.disconnect();
    assertEquals(channelA.getID(), eventIds[0]);
    // technically, getConnectedID() should return null when a container has
    // disconnected, but anyway...
    assertEquals(containerA.getConnectedID(), eventIds[1]);
}
Also used : IChannelListener(org.eclipse.ecf.datashare.IChannelListener) IChannelEvent(org.eclipse.ecf.datashare.events.IChannelEvent) IChannelDisconnectEvent(org.eclipse.ecf.datashare.events.IChannelDisconnectEvent) ID(org.eclipse.ecf.core.identity.ID)

Aggregations

ID (org.eclipse.ecf.core.identity.ID)1 IChannelListener (org.eclipse.ecf.datashare.IChannelListener)1 IChannelDisconnectEvent (org.eclipse.ecf.datashare.events.IChannelDisconnectEvent)1 IChannelEvent (org.eclipse.ecf.datashare.events.IChannelEvent)1