2525
2626from .compat import basestring , byte_type , decode_from_bytes , encode_to_bytes , text_type
2727from .utils import (
28- SSL_PROTOCOL ,
2928 MocketMode ,
3029 MocketSocketCore ,
3130 get_mocketize ,
@@ -98,20 +97,9 @@ def check_hostname(self):
9897 def check_hostname (self , _ ):
9998 self ._check_hostname = False
10099
101- def __init__ (self , sock = None , server_hostname = None , _context = None , * args , ** kwargs ):
100+ def __init__ (self , * args , ** kwargs ):
102101 self ._set_dummy_methods ()
103102
104- if isinstance (sock , MocketSocket ):
105- self .sock = sock
106- self .sock ._host = server_hostname
107- self .sock .true_socket = true_ssl_socket (
108- sock = self .sock .true_socket ,
109- server_hostname = server_hostname ,
110- _context = true_ssl_context (protocol = SSL_PROTOCOL ),
111- )
112- elif isinstance (sock , int ) and true_ssl_context :
113- self .context = true_ssl_context (sock )
114-
115103 def _set_dummy_methods (self ):
116104 def dummy_method (* args , ** kwargs ):
117105 pass
@@ -120,7 +108,7 @@ def dummy_method(*args, **kwargs):
120108 setattr (self , m , dummy_method )
121109
122110 @staticmethod
123- def wrap_socket (sock = sock , * args , ** kwargs ):
111+ def wrap_socket (sock , * args , ** kwargs ):
124112 sock .kwargs = kwargs
125113 sock ._secure_socket = True
126114 return sock
@@ -131,10 +119,6 @@ def wrap_bio(incoming, outcoming, *args, **kwargs):
131119 ssl_obj ._host = kwargs ["server_hostname" ]
132120 return ssl_obj
133121
134- def __getattr__ (self , name ):
135- if self .sock is not None :
136- return getattr (self .sock , name )
137-
138122
139123def create_connection (address , timeout = None , source_address = None ):
140124 s = socket .socket (socket .AF_INET , socket .SOCK_STREAM , socket .IPPROTO_TCP )
0 commit comments