Class: Openas2::Remote::Connection
- Inherits:
-
Object
- Object
- Openas2::Remote::Connection
- Defined in:
- lib/openas2/remote/connection.rb
Instance Attribute Summary collapse
-
#socket ⇒ Object
Returns the value of attribute socket.
-
#ssl_context ⇒ Object
Returns the value of attribute ssl_context.
-
#ssl_socket ⇒ Object
Returns the value of attribute ssl_socket.
Instance Method Summary collapse
- #close ⇒ Object
- #connect ⇒ Object
- #gets ⇒ Object
-
#initialize(host = 'localhost', port = 4321, ciphers = []) ⇒ Connection
constructor
A new instance of Connection.
- #puts(s) ⇒ Object
- #readlines ⇒ Object
Constructor Details
#initialize(host = 'localhost', port = 4321, ciphers = []) ⇒ Connection
Returns a new instance of Connection.
10 11 12 13 14 15 |
# File 'lib/openas2/remote/connection.rb', line 10 def initialize(host='localhost', port=4321, ciphers=[]) ciphers << ["ADH-AES256-SHA", "TLSv1/SSLv3", 256, 256] @socket = TCPSocket.new(host, port) @ssl_context = OpenSSL::SSL::SSLContext.new @ssl_context.ciphers = ciphers end |
Instance Attribute Details
#socket ⇒ Object
Returns the value of attribute socket.
8 9 10 |
# File 'lib/openas2/remote/connection.rb', line 8 def socket @socket end |
#ssl_context ⇒ Object
Returns the value of attribute ssl_context.
8 9 10 |
# File 'lib/openas2/remote/connection.rb', line 8 def ssl_context @ssl_context end |
#ssl_socket ⇒ Object
Returns the value of attribute ssl_socket.
8 9 10 |
# File 'lib/openas2/remote/connection.rb', line 8 def ssl_socket @ssl_socket end |
Instance Method Details
#close ⇒ Object
35 36 37 |
# File 'lib/openas2/remote/connection.rb', line 35 def close @ssl_socket.close end |
#connect ⇒ Object
17 18 19 20 21 |
# File 'lib/openas2/remote/connection.rb', line 17 def connect @ssl_socket = OpenSSL::SSL::SSLSocket.new(@socket, @ssl_context) @ssl_socket.sync_close = true @ssl_socket.connect end |
#gets ⇒ Object
31 32 33 |
# File 'lib/openas2/remote/connection.rb', line 31 def gets @ssl_socket.gets end |
#puts(s) ⇒ Object
27 28 29 |
# File 'lib/openas2/remote/connection.rb', line 27 def puts(s) @ssl_socket.puts(s) end |
#readlines ⇒ Object
23 24 25 |
# File 'lib/openas2/remote/connection.rb', line 23 def readlines @ssl_socket.readlines end |