tcp-client 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tcp-client/ssl_socket.rb +1 -0
- data/lib/tcp-client/version.rb +1 -1
- data/test/tcp_client_test.rb +14 -10
- data/test/test_helper.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b265053761a87007b7de21c3a7a369b778f013ae726bb26220a4fd9aeeaf71c
|
4
|
+
data.tar.gz: 5a71b5dc86ed4ab9ef481e65c24aef0481c5e9d2c868f3f9975b801936d99691
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d16d436959c3e1c29962a5c474de8db3b4638e2d99aaf66fe4046b22e8159298cc433e014b14d9c9b3e01cafff1052743cf90896c396d86e1ccfc87d689553da
|
7
|
+
data.tar.gz: 70f4ce83fd7c7c8aa4c066fb94e96ef62a5087c3f78e079cd473e8d45ab22e106eea7b3d7bf5965063fecb9b77c58b8548598f4a873d9480c5b501bc7854dea9
|
data/lib/tcp-client/version.rb
CHANGED
data/test/tcp_client_test.rb
CHANGED
@@ -11,6 +11,10 @@ class TCPClientTest < MiniTest::Test
|
|
11
11
|
@config = TCPClient::Configuration.create(buffered: false)
|
12
12
|
end
|
13
13
|
|
14
|
+
def port
|
15
|
+
PseudoServer.local_address.ip_port
|
16
|
+
end
|
17
|
+
|
14
18
|
def test_defaults
|
15
19
|
subject = TCPClient.new
|
16
20
|
assert(subject.closed?)
|
@@ -43,15 +47,15 @@ class TCPClientTest < MiniTest::Test
|
|
43
47
|
end
|
44
48
|
|
45
49
|
def test_connected_state
|
46
|
-
TCPClient.open(
|
50
|
+
TCPClient.open("localhost:#{port}", config) do |subject|
|
47
51
|
refute(subject.closed?)
|
48
|
-
assert_equal(
|
52
|
+
assert_equal("localhost:#{port}", subject.to_s)
|
49
53
|
refute_nil(subject.address)
|
50
54
|
address_when_opened = subject.address
|
51
|
-
assert_equal(
|
55
|
+
assert_equal("localhost:#{port}", subject.address.to_s)
|
52
56
|
assert_equal('localhost', subject.address.hostname)
|
53
57
|
assert_instance_of(Addrinfo, subject.address.addrinfo)
|
54
|
-
assert_same(
|
58
|
+
assert_same(port, subject.address.addrinfo.ip_port)
|
55
59
|
|
56
60
|
subject.close
|
57
61
|
assert(subject.closed?)
|
@@ -60,7 +64,7 @@ class TCPClientTest < MiniTest::Test
|
|
60
64
|
end
|
61
65
|
|
62
66
|
def check_read_timeout(timeout)
|
63
|
-
TCPClient.open(
|
67
|
+
TCPClient.open("localhost:#{port}", config) do |subject|
|
64
68
|
refute(subject.closed?)
|
65
69
|
start_time = nil
|
66
70
|
assert_raises(TCPClient::ReadTimeoutError) do
|
@@ -78,7 +82,7 @@ class TCPClientTest < MiniTest::Test
|
|
78
82
|
end
|
79
83
|
|
80
84
|
def check_write_timeout(timeout)
|
81
|
-
TCPClient.open(
|
85
|
+
TCPClient.open("localhost:#{port}", config) do |subject|
|
82
86
|
refute(subject.closed?)
|
83
87
|
start_time = nil
|
84
88
|
assert_raises(TCPClient::WriteTimeoutError) do
|
@@ -95,7 +99,7 @@ class TCPClientTest < MiniTest::Test
|
|
95
99
|
end
|
96
100
|
|
97
101
|
def test_write_deadline
|
98
|
-
TCPClient.open(
|
102
|
+
TCPClient.open("localhost:#{port}", config) do |subject|
|
99
103
|
refute(subject.closed?)
|
100
104
|
assert_raises(TCPClient::WriteTimeoutError) do
|
101
105
|
subject.with_deadline(0.25) do |*args|
|
@@ -107,7 +111,7 @@ class TCPClientTest < MiniTest::Test
|
|
107
111
|
end
|
108
112
|
|
109
113
|
def test_read_deadline
|
110
|
-
TCPClient.open(
|
114
|
+
TCPClient.open("localhost:#{port}", config) do |subject|
|
111
115
|
refute(subject.closed?)
|
112
116
|
assert_raises(TCPClient::ReadTimeoutError) do
|
113
117
|
subject.with_deadline(0.25) do |*args|
|
@@ -119,7 +123,7 @@ class TCPClientTest < MiniTest::Test
|
|
119
123
|
end
|
120
124
|
|
121
125
|
def test_read_write_deadline
|
122
|
-
TCPClient.open(
|
126
|
+
TCPClient.open("localhost:#{port}", config) do |subject|
|
123
127
|
refute(subject.closed?)
|
124
128
|
assert_raises(TCPClient::TimeoutError) do
|
125
129
|
subject.with_deadline(0.25) do |*args|
|
@@ -137,7 +141,7 @@ class TCPClientTest < MiniTest::Test
|
|
137
141
|
start_time = nil
|
138
142
|
assert_raises(TCPClient::ConnectTimeoutError) do
|
139
143
|
start_time = Time.now
|
140
|
-
TCPClient.new.connect(
|
144
|
+
TCPClient.new.connect("localhost:#{port}", ssl_config)
|
141
145
|
end
|
142
146
|
assert_in_delta(ssl_config.connect_timeout, Time.now - start_time, 0.25)
|
143
147
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tcp-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Blumtritt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
|
-
rubygems_version: 3.2.
|
110
|
+
rubygems_version: 3.2.22
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: A TCP client implementation with working timeout support.
|