<commit_before># -*- encoding: utf-8 -*-

require 'spec_helper'

describe Stomp::Connection do

  before(:each) do
    @parameters = {
      :hosts => [
        {:login => "login1", :passcode => "<PASSWORD>", :host => "localhost", :port => 61616, :ssl => false},
        {:login => "login2", :passcode => "<PASSWORD>", :host => "remotehost", :port => 61617, :ssl => false}
      ],
      :reliable => true,
      :initial_reconnect_delay => 0.01,
      :max_reconnect_delay => 30.0,
      :use_exponential_back_off => true,
      :back_off_multiplier => 2,
      :max_reconnect_attempts => 0,
      :randomize => false,
      :connect_timeout => 0,
      :parse_timeout => 5,
      :connect_headers => {},
      :dmh => false,
      :closed_check => true,
      :hbser => false,
      :stompconn => false,
      :usecrlf => false,
      :max_hbread_fails => 0,
      :max_hbrlck_fails => 0,
      :fast_hbs_adjust => 0.0,
      :connread_timeout => 0,
      :tcp_nodelay => true,
      :start_timeout => 0,
      :sslctx_newparm => nil,
      :ssl_post_conn_check => true,
   }
        
    #POG:
    class Stomp::Connection
      def _receive( s, connread = false )
      end
    end
    
    # clone() does a shallow copy, we want a deep one so we can garantee the hosts order
    normal_parameters = Marshal::load(Marshal::dump(@parameters))

    @tcp_socket = double(:tcp_socket, :close => nil, :puts => nil, :write => nil, :setsockopt => nil, :flush => true)
    allow(TCPSocket).to receive(:open).and_return @tcp_socket
    @connection = Stomp::Connection.new(normal_parameters)
  end

  describe "autoflush" do
    let(:parameter_hash) {
      {<commit_msg>Correct _receive method signature.<commit_after># -*- encoding: utf-8 -*-

require 'spec_helper'

describe Stomp::Connection do

  before(:each) do
    @parameters = {
      :hosts => [
        {:login => "login1", :passcode => "<PASSWORD>", :host => "localhost", :port => 61616, :ssl => false},
        {:login => "login2", :passcode => "<PASSWORD>", :host => "remotehost", :port => 61617, :ssl => false}
      ],
      :reliable => true,
      :initial_reconnect_delay => 0.01,
      :max_reconnect_delay => 30.0,
      :use_exponential_back_off => true,
      :back_off_multiplier => 2,
      :max_reconnect_attempts => 0,
      :randomize => false,
      :connect_timeout => 0,
      :parse_timeout => 5,
      :connect_headers => {},
      :dmh => false,
      :closed_check => true,
      :hbser => false,
      :stompconn => false,
      :usecrlf => false,
      :max_hbread_fails => 0,
      :max_hbrlck_fails => 0,
      :fast_hbs_adjust => 0.0,
      :connread_timeout => 0,
      :tcp_nodelay => true,
      :start_timeout => 0,
      :sslctx_newparm => nil,
      :ssl_post_conn_check => true,
   }
        
    #POG:
    class Stomp::Connection
      def _receive( s, connread = false, niocheck = false )
      end
    end
    
    # clone() does a shallow copy, we want a deep one so we can garantee the hosts order
    normal_parameters = Marshal::load(Marshal::dump(@parameters))

    @tcp_socket = double(:tcp_socket, :close => nil, :puts => nil, :write => nil, :setsockopt => nil, :flush => true)
    allow(TCPSocket).to receive(:open).and_return @tcp_socket
    @connection = Stomp::Connection.new(normal_parameters)
  end

  describe "autoflush" do
    let(:parameter_hash) {
      {
{'fraction_non_alphanumeric': 0.15176715176715178, 'fraction_numerical': 0.017226017226017225, 'mean_word_length': 2.750556792873051, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 85, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5074837', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1120, 'n_words': 261}