class Publisher {

	public boolean connect(String uri, String exchange, String exchangeType) {
		assertIsSupportedExchangeType(exchangeType);
		this.uri = uri;
		this.exchange = exchange;

		try {
			factory.setUri(uri);
		} catch (URISyntaxException e) {
			e.printStackTrace();
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		} catch (KeyManagementException e) {
			e.printStackTrace();
		}

		try {
			Log.info("Connect to publish/subscribe server: " + toString());
			connection = factory.newConnection();
			channel = connection.createChannel();
			channel.exchangeDeclare(exchange, exchangeType,true);
		} catch (IOException | TimeoutException e) {
			Log.error("Unable to connect to publish/subscribe server: " + toString());
			e.printStackTrace();
			return false;
		}

		return true;
	}

	@Inject public  Publisher(ConnectionFactory factory);

}