@Override
    public void connect(ConnectionCallback connectionCallback, State state) throws ConnectionUnavailableException {
        this.connectionCallback = connectionCallback;
        if (fail) {
            numberOfErrorOccurred++;
            throw new ConnectionUnavailableException("Connection failed!");
        }
        super.connect(connectionCallback, state);
    }
Implementation of Source to receive events through in-memory transport for unavailability checking.
modules/siddhi-core/src/test/java/io/siddhi/core/transport/TestFailingInMemorySource.java