def run
      loop do
        # Wait for a client to connect and then create a thread for it
        Thread.new(@server.accept) do |client_socket|
          logger.info "Accepted client: #{client_socket.peeraddr.join(':')}"
          server_socket = TCPSocket.new(@server_host, @server_port)
          begin
            process_packets(client_socket, server_socket)
          rescue Exception => exp
            logger.error exp.to_s
          end
          logger.info "Disconnected: #{client_socket.peeraddr.join(':')}"
          server_socket.close
          client_socket.close
        end
      end
    end
def run
      loop do
        # Wait for a client to connect and then create a thread for it
        Thread.new(@server.accept) do |client_socket|
          logger.info "Accepted client: #{client_socket.peeraddr.join(':')}"
          server_socket = TCPSocket.new(@server_host, @server_port)
          begin
            process_packets(client_socket, server_socket)
          rescue Exception => exp
            logger.error exp.to_s
          end
          logger.info "Disconnected: #{client_socket.peeraddr.join(':')}"
          server_socket.close
          client_socket.close
        end
      end
    end
Create a new MQTT Proxy instance.

 Possible argument keys:

  :local_host      Address to bind listening socket to.
  :local_port      Port to bind listening socket to.
  :server_host     Address of upstream server to send packets upstream to.
  :server_port     Port of upstream server to send packets upstream to.
  :select_timeout  Time in seconds before disconnecting a connection.
  :logger          Ruby Logger object to send informational messages to.

 NOTE: be careful not to connect to yourself!
 Start accepting connections and processing packets.