class InMemoryConnector implements IncomingConnectorFactory, OutgoingConnectorFactory {

    public <T> InMemorySource<T> source(String channel) {
        if (channel == null) {
            throw ex.illegalArgumentChannelMustNotBeNull();
        }
        InMemorySourceImpl<?> source = sources.get(channel);
        if (source == null) {
            throw ex.illegalArgumentUnknownChannel(channel);
        }
        //noinspection unchecked
        return (InMemorySource<T>) source;
    }

}