public FrameHandler create(Address addr) throws IOException {
   String hostName = addr.getHost();
   int portNumber = ConnectionFactory.portOrDefault(addr.getPort(), ssl);
   Socket socket = null;
   try {
     socket = factory.createSocket();
     configurator.configure(socket);
     socket.connect(new InetSocketAddress(hostName, portNumber), connectionTimeout);
     return create(socket);
   } catch (IOException ioe) {
     quietTrySocketClose(socket);
     throw ioe;
   }
 }
Beispiel #2
0
 /**
  * If this option is set, camel-rabbitmq will try to create connection based on the setting of
  * option addresses. The addresses value is a string which looks like "server1:12345,
  * server2:12345"
  */
 public void setAddresses(String addresses) {
   Address[] addressArray = Address.parseAddresses(addresses);
   if (addressArray.length > 0) {
     this.addresses = addressArray;
   }
 }
 /**
  * Sets the {@code addresses}.
  *
  * @param addresses formatted as "host1[:port],host2[:port]", etc.
  * @throws NullPointerException if {@code addresses} is null
  */
 public ConnectionOptions withAddresses(String addresses) {
   this.addresses = Address.parseAddresses(Assert.notNull(addresses, "addresses"));
   return this;
 }