module Byebug

def start_client(host = 'localhost', port = PORT)


Connects to the remote byebug
def start_client(host = 'localhost', port = PORT)
  Context.interface = LocalInterface.new
  puts 'Connecting to byebug server...'
  socket = TCPSocket.new(host, port)
  puts 'Connected.'
  catch(:exit) do
    while (line = socket.gets)
      case line
      when /^PROMPT (.*)$/
        input = Context.interface.read_command(Regexp.last_match[1])
        throw :exit unless input
        socket.puts input
      when /^CONFIRM (.*)$/
        input = Context.interface.confirm(Regexp.last_match[1])
        throw :exit unless input
        socket.puts input
      else
        puts line
      end
    end
  end
  socket.close
end