sanford-protocol 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,6 +43,10 @@ module Sanford::Protocol
43
43
  @socket.close
44
44
  end
45
45
 
46
+ def close_write
47
+ @socket.close_write
48
+ end
49
+
46
50
  private
47
51
 
48
52
  def wait_for_data(timeout)
@@ -78,6 +82,10 @@ module Sanford::Protocol
78
82
  tcp_socket.close rescue false
79
83
  end
80
84
 
85
+ def close_write
86
+ tcp_socket.close_write rescue false
87
+ end
88
+
81
89
  protected
82
90
 
83
91
  def recv(number_of_bytes, *flags)
@@ -55,5 +55,13 @@ module Sanford::Protocol::Test
55
55
  !!@closed
56
56
  end
57
57
 
58
+ def close_write
59
+ @write_stream_closed = true
60
+ end
61
+
62
+ def write_stream_closed?
63
+ !!@write_stream_closed
64
+ end
65
+
58
66
  end
59
67
  end
@@ -1,5 +1,5 @@
1
1
  module Sanford
2
2
  module Protocol
3
- GEM_VERSION = "0.5.4"
3
+ GEM_VERSION = "0.5.5"
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ class Sanford::Protocol::Connection
12
12
  end
13
13
  subject{ @connection }
14
14
 
15
- should have_instance_methods :read, :write, :close, :peek
15
+ should have_instance_methods :read, :write, :close, :peek, :close_write
16
16
 
17
17
  should "read messages off the socket with #read" do
18
18
  assert_equal @data, subject.read
@@ -32,6 +32,11 @@ class Sanford::Protocol::Connection
32
32
  assert_equal @socket.in[0, 1], subject.peek
33
33
  end
34
34
 
35
+ should "close the write stream of the socket with #close_write" do
36
+ subject.close_write
37
+ assert @socket.write_stream_closed?
38
+ end
39
+
35
40
  end
36
41
 
37
42
  class RealConnectionTests < BaseTests
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanford-protocol
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 4
10
- version: 0.5.4
9
+ - 5
10
+ version: 0.5.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Collin Redding
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2013-03-04 00:00:00 Z
19
+ date: 2013-03-14 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  prerelease: false