Invokes the appropriate ConnectionListener method
if (type == OPENED)
((ConnectionListener)listener).opened(this);
else if (type == DISCONNECTED)
((ConnectionListener)listener).disconnected(this);
else if (type == CLOSED)
((ConnectionListener)listener).closed(this);