Sha256: d1a902e9e80f5d53149b532a532cf77581cb1646ead750fd72c057e61170d58e

Contents?: true

Size: 1.46 KB

Versions: 134

Compression:

Stored size: 1.46 KB

Contents

# Copyright (C) 2014  Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

require "socket"

module GioTestUtils
  module SocketClient
    def setup_socket_client
      setup_server
      setup_client
      setup_loop
    end

    def teardown_socket_client
      teardown_loop
      teardown_client
      teardown_server
    end

    def setup_server
      @host = "127.0.0.1"
      @server = TCPServer.new(@host, 0)
      @port = @server.addr[1]
    end

    def teardown_server
      @server.close
    end

    def setup_client
      @client = Gio::SocketClient.new
      @connection = @client.connect_to_host(@host, @port)
    end

    def teardown_client
      @connection.close
    end

    def setup_loop
      @loop = GLib::MainLoop.new
    end

    def teardown_loop
    end
  end
end

Version data entries

134 entries across 126 versions & 2 rubygems

Version Path
gio2-3.3.6 test/gio2-test-utils/socket-client.rb
gio2-3.3.5 test/gio2-test-utils/socket-client.rb
gio2-3.3.4 test/gio2-test-utils/socket-client.rb
gio2-3.3.3 test/gio2-test-utils/socket-client.rb
gio2-3.3.2 test/gio2-test-utils/socket-client.rb
gio2-3.3.1 test/gio2-test-utils/socket-client.rb
gio2-3.3.0 test/gio2-test-utils/socket-client.rb
gio2-3.2.9-x64-mingw32 test/gio2-test-utils/socket-client.rb
gio2-3.2.9-x86-mingw32 test/gio2-test-utils/socket-client.rb
gio2-3.2.9 test/gio2-test-utils/socket-client.rb
gio2-3.2.8-x64-mingw32 test/gio2-test-utils/socket-client.rb
gio2-3.2.8-x86-mingw32 test/gio2-test-utils/socket-client.rb
gio2-3.2.8 test/gio2-test-utils/socket-client.rb
gio2-3.2.7-x86-mingw32 test/gio2-test-utils/socket-client.rb
gio2-3.2.7-x64-mingw32 test/gio2-test-utils/socket-client.rb
gio2-3.2.7 test/gio2-test-utils/socket-client.rb
gio2-3.2.6-x64-mingw32 test/gio2-test-utils/socket-client.rb
gio2-3.2.6-x86-mingw32 test/gio2-test-utils/socket-client.rb
gio2-3.2.6 test/gio2-test-utils/socket-client.rb
gio2-3.2.5-x64-mingw32 test/gio2-test-utils/socket-client.rb