# File lib/em-http/client.rb, line 319
    def dispatch
      while case @state
          when :connect_socks_proxy
            parse_socks_response
          when :connect_http_proxy
            parse_response_header
          when :response_header
            parse_response_header
          when :chunk_header
            parse_chunk_header
          when :chunk_body
            process_chunk_body
          when :chunk_footer
            process_chunk_footer
          when :response_footer
            process_response_footer
          when :body
            process_body
          when :websocket
            process_websocket
          when :finished, :invalid
            break
          else raise RuntimeError, "invalid state: #{@state}"
        end
      end