def test_get_http2_layer(self): context = LayerContext(mode="socks", port=443, scheme="h2") replay_layer = ReplayLayer(context) layer = layer_manager._next_layer(self.server_state, replay_layer, context) self.assertIsInstance(layer, Http2Layer) tls_layer = TlsLayer(self.server_state, context) layer = layer_manager._next_layer(self.server_state, tls_layer, context) self.assertIsInstance(layer, Http2Layer)
def test_get_tls_layer_from_socks(self): context = LayerContext(mode="socks", port=443) socks_layer = SocksLayer(context) layer = layer_manager._next_layer(self.server_state, socks_layer, context) self.assertIsInstance(layer, TlsLayer)
def test_get_http_layer_from_http_layer(self): context = LayerContext(mode="http", scheme="http", port=80) http_layer = Http1Layer(self.server_state, context) layer = layer_manager._next_layer(self.server_state, http_layer, context) self.assertIsInstance(layer, Http1Layer)
def test_get_http1_layer_from_socks_replay(self): context = LayerContext(mode="socks", port=80) socks_layer = SocksLayer(context) layer = layer_manager._next_layer(self.server_state, socks_layer, context) self.assertIsInstance(layer, Http1Layer) context.scheme = "http" replay_layer = ReplayLayer(context) layer = layer_manager._next_layer(self.server_state, replay_layer, context) self.assertIsInstance(layer, Http1Layer) context.scheme = "https" tls_layer = TlsLayer(self.server_state, context) layer = layer_manager._next_layer(self.server_state, tls_layer, context) self.assertIsInstance(layer, Http1Layer)
def test_get_http_layer_from_http_layer(self): context = LayerContext(mode="http", scheme="http", port=80) http_layer = Http1Layer(self.server_state, context) layer = layer_manager._next_layer( self.server_state, http_layer, context) self.assertIsInstance(layer, Http1Layer)
def test_get_forward_layer_from_socks_replay(self): context = LayerContext(mode="socks", port=5555) socks_layer = SocksLayer(context) layer = layer_manager._next_layer(self.server_state, socks_layer, context) self.assertIsInstance(layer, ForwardLayer) context.scheme = "test" replay_layer = ReplayLayer(context) layer = layer_manager._next_layer(self.server_state, replay_layer, context) self.assertIsInstance(layer, ForwardLayer) context.scheme = "test" tls_layer = TlsLayer(self.server_state, context) layer = layer_manager._next_layer(self.server_state, tls_layer, context) self.assertIsInstance(layer, ForwardLayer)
def test_get_http1_layer_from_transparent(self): context = LayerContext(mode="socks", port=80) transparent_layer = TransparentLayer(context) layer = layer_manager._next_layer(self.server_state, transparent_layer, context) self.assertIsInstance(layer, Http1Layer)