class Grocer::SSLConnection

Public Instance Methods

connect() click to toggle source
# File lib/notifiable/apns/apnotic/grocer_ssl_connection.rb, line 3
def connect
  context = OpenSSL::SSL::SSLContext.new
  context.key  = OpenSSL::PKey::RSA.new(certificate, passphrase)
  context.cert = OpenSSL::X509::Certificate.new(certificate)

  @sock            = TCPSocket.new(gateway, port)
  @sock.setsockopt   Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true
  @ssl             = OpenSSL::SSL::SSLSocket.new(@sock, context)
  @ssl.sync        = true
  @ssl.connect
end