title: How Socks5 proxy can be integrated with Spring Boot to connect AMQP - RabbitMQ via code
body: <p>Basically I am trying to use SOCKS5 proxy to connect RabbitMq with Spring Boot project.</p>
  <p>I have created Custom Socket factory and connected to PostgreDB , in that case that connection object accepts SocketFactory as parameter like given below;</p>
  <pre><code>Properties props = new Properties();
  props.setProperty(&quot;user&quot;, &quot;username&quot;);
  props.setProperty(&quot;password&quot;, &quot;password&quot;);
  props.setProperty(&quot;socketFactory&quot;, DBSocketFactory.class.getName());
  Connection conn = DriverManager.getConnection(url, props);
  return conn;
  </code></pre>
  <p>Can anyonw please help, how we can achieve to connect RabbitMq in Spring Boot project via SOCKS5 proxy.</p>
  <p>In project we use pretty standard ConnectorFactory beans and RabbitTemplate annotated methods like given below</p>
  <pre><code>@Bean(name = &quot;default-rabbit-connection-factory&quot;)
      public ConnectionFactory defaultConnectionFactory() {
  
          RabbitConnectionDto defaultConnectionDto = rabbitConnectionProperty.getConnections().stream()
                  .filter(con -&gt; con.getName().equals(&quot;DEFAULT&quot;))
                  .findFirst()
                  .orElse(null);
  
          if (defaultConnectionDto == null) {
              log.error(&quot;No default Rabbit Connection!!!&quot;);
              return null;
          }
  
          return getConnectionFactory(defaultConnectionDto);
      }
  
      @Bean(name = &quot;defaultRabbitTemplate&quot;)
      public RabbitTemplate defaultRabbitTemplate() {
          return new RabbitTemplate(defaultConnectionFactory());
      }
  </code></pre>
  <p>Thanks!</p>