'Create SSL socket object
@param ctx: SSL context
@type ctx: OpenSSL.SSL.Context
@param sock: underlying socket object
@type sock: socket.socket'

def __init__(self, ctx, sock=None):

    if (sock is not None):
        self.socket = sock
    else:
        self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    self.__ssl_conn = SSL.Connection(ctx, self.socket)
    self.buf_size = self.__class__.default_buf_size
    self._makefile_refs = 0
