Repository: mitmproxy/mitmproxy

Issue:
v7 reverse proxying tcp protocols crashing
#### Problem Description

i'm trying to proxy tcp protocols and periodically getting a crash:

./mitmdump --set termlog_verbosity=debug  --mode reverse:https://pop.gmail.com:995 --set connection_strategy=eager -w mail --set flow_detail=3 -p 8181

```console
% ./mitmdump --set termlog_verbosity=debug  --mode reverse:https://pop.gmail.com:995 --set connection_strategy=eager -w mail --set flow_detail=3 -p 8181
Proxy server listening at http://*:8181
[::1]:64076: client connect
[::1]:64076: server connect pop.gmail.com (172.253.123.109:995)
[::1]:64076: mitmproxy has crashed!
Traceback (most recent call last):
  File "mitmproxy/proxy/server.py", line 279, in server_event
  File "mitmproxy/proxy/layer.py", line 144, in handle_event
  File "mitmproxy/proxy/layer.py", line 144, in handle_event
  File "mitmproxy/proxy/tunnel.py", line 72, in _handle_event
  File "mitmproxy/proxy/layers/tls.py", line 240, in receive_data
  File "mitmproxy/proxy/layers/tls.py", line 306, in event_to_child
  File "mitmproxy/proxy/tunnel.py", line 104, in event_to_child
  File "mitmproxy/proxy/layer.py", line 144, in handle_event
  File "mitmproxy/proxy/tunnel.py", line 72, in _handle_event
  File "mitmproxy/proxy/layers/tls.py", line 225, in receive_data
AttributeError: 'NoneType' object has no attribute 'bio_write'

[::1]:64076: client disconnect
[::1]:64076: closing transports...
[::1]:64076: server disconnect pop.gmail.com (172.253.123.109:995)
[::1]:64076: transports closed!
[::1]:64180: client connect
[::1]:64180: server connect pop.gmail.com (172.253.123.109:995)
[::1]:64180 <- tcp <- pop.gmail.com:995

    +OK Gpop ready for requests from 24.137.254.57 s4mb63968478vsi

[::1]:64180 -> tcp -> pop.gmail.com:995

    CAPA

[::1]:64180 <- tcp <- pop.gmail.com:995

    +OK Capability list follows
    USER
    RESP-CODES
    EXPIRE 0
    LOGIN-DELAY 300
    TOP
    UIDL
    X-GOOGLE-RICO
    SASL PLAIN XOAUTH2 OAUTHBEARER
    .

[::1]:64180: half-closing Server(pop.gmail.com:995, state=open, tls, src_port=64181)
[::1]:64180: server disconnect pop.gmail.com (172.253.123.109:995)
[::1]:64180: client disconnect
[::1]:64180: closing transports...
[::1]:64180: transports closed!
```

#### System Information

% ./mitmdump --version
Mitmproxy: 7.0.0.dev binary
Python:    3.9.5
OpenSSL:   OpenSSL 1.1.1k  25 Mar 2021
Platform:  macOS-11.2.3-x86_64-i386-64bit

v7 reverse proxying tcp protocols crashing
#### Problem Description

i'm trying to proxy tcp protocols and periodically getting a crash:

./mitmdump --set termlog_verbosity=debug  --mode reverse:https://pop.gmail.com:995 --set connection_strategy=eager -w mail --set flow_detail=3 -p 8181

```console
% ./mitmdump --set termlog_verbosity=debug  --mode reverse:https://pop.gmail.com:995 --set connection_strategy=eager -w mail --set flow_detail=3 -p 8181
Proxy server listening at http://*:8181
[::1]:64076: client connect
[::1]:64076: server connect pop.gmail.com (172.253.123.109:995)
[::1]:64076: mitmproxy has crashed!
Traceback (most recent call last):
  File "mitmproxy/proxy/server.py", line 279, in server_event
  File "mitmproxy/proxy/layer.py", line 144, in handle_event
  File "mitmproxy/proxy/layer.py", line 144, in handle_event
  File "mitmproxy/proxy/tunnel.py", line 72, in _handle_event
  File "mitmproxy/proxy/layers/tls.py", line 240, in receive_data
  File "mitmproxy/proxy/layers/tls.py", line 306, in event_to_child
  File "mitmproxy/proxy/tunnel.py", line 104, in event_to_child
  File "mitmproxy/proxy/layer.py", line 144, in handle_event
  File "mitmproxy/proxy/tunnel.py", line 72, in _handle_event
  File "mitmproxy/proxy/layers/tls.py", line 225, in receive_data
AttributeError: 'NoneType' object has no attribute 'bio_write'

[::1]:64076: client disconnect
[::1]:64076: closing transports...
[::1]:64076: server disconnect pop.gmail.com (172.253.123.109:995)
[::1]:64076: transports closed!
[::1]:64180: client connect
[::1]:64180: server connect pop.gmail.com (172.253.123.109:995)
[::1]:64180 <- tcp <- pop.gmail.com:995

    +OK Gpop ready for requests from 24.137.254.57 s4mb63968478vsi

[::1]:64180 -> tcp -> pop.gmail.com:995

    CAPA

[::1]:64180 <- tcp <- pop.gmail.com:995

    +OK Capability list follows
    USER
    RESP-CODES
    EXPIRE 0
    LOGIN-DELAY 300
    TOP
    UIDL
    X-GOOGLE-RICO
    SASL PLAIN XOAUTH2 OAUTHBEARER
    .

[::1]:64180: half-closing Server(pop.gmail.com:995, state=open, tls, src_port=64181)
[::1]:64180: server disconnect pop.gmail.com (172.253.123.109:995)
[::1]:64180: client disconnect
[::1]:64180: closing transports...
[::1]:64180: transports closed!
```

#### System Information

% ./mitmdump --version
Mitmproxy: 7.0.0.dev binary
Python:    3.9.5
OpenSSL:   OpenSSL 1.1.1k  25 Mar 2021
Platform:  macOS-11.2.3-x86_64-i386-64bit



Discussion:
Thanks for testing the 7.0 snapshots! Any idea how I can reproduce this? Can you trigger this with `-vvv -set proxy_debug`? An extended log would be incredibly helpful for debugging this. Feel free to shoot me an email with your logs if you want to keep them private.
to reproduce this (if you have a mac), i'm using the Apple Mail.app. Set up a POP / SMTP account and point the POP one at localhost 8181, TLS on, password auth.

```console
./mitmdump --set termlog_verbosity=debug  --mode reverse:https://pop.gmail.com:995 --set connection_strategy=eager -w mail_debug --set flow_detail=3 -p 8181 -vvv --set proxy_debug=true
Proxy server listening at http://*:8181
[::1]:65101: client connect
[::1]:65101:   >> Start({})
[::1]:65101:   << NextLayerHook(data=NextLayer:None)
[::1]:65101:   >! DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101:   >> Reply(NextLayerHook(data=NextLayer:ReverseProxy()),None)
[::1]:65101:   [nextlayer] ReverseProxy()
[::1]:65101:   >> Start({})
[::1]:65101:   << OpenConnection({'connection': Server({'id': '…2c6973', 'address': ('pop.gmail.com', 995), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'pop.gmail.com', 'tls': True})})
[::1]:65101:   << OpenConnection({'connection': Server({'id': '…2c6973', 'address': ('pop.gmail.com', 995), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'pop.gmail.com', 'tls': True})})
[::1]:65101:   !> DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101:   >! DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101: server connect pop.gmail.com (172.217.193.108:995)
[::1]:65101:   >> Reply(OpenConnection({'connection': Server({'id': '…2c6973', 'address': ('pop.gmail.com', 995), 'state': <ConnectionState.OPEN: 3>, 'sni': 'pop.gmail.com', 'tls': True, 'timestamp_start': 1623947635.39981, 'timestamp_tcp_setup': 1623947635.4746208, 'peername': ('172.217.193.108', 995), 'sockname': ('192.168.86.222', 65102)})}),None)
[::1]:65101:     >> Start({})
[::1]:65101:     << TlsStartHook(data=TlsStartData(conn=Server({'id': '…2c6973', 'address': ('pop.gmail.com', 995), 'state': <ConnectionState.OPEN: 3>, 'sni': 'pop.gmail.com', 'tls': True, 'timestamp_start': 1623947635.39981, 'timestamp_tcp_setup': 1623947635.4746208, 'peername': ('172.217.193.108', 995), 'sockname': ('192.168.86.222', 65102)}), context=<mitmproxy.proxy.context.Context object at 0x112e57880>, ssl_conn=None))
[::1]:65101:   << TlsStartHook(data=TlsStartData(conn=Server({'id': '…2c6973', 'address': ('pop.gmail.com', 995), 'state': <ConnectionState.OPEN: 3>, 'sni': 'pop.gmail.com', 'tls': True, 'timestamp_start': 1623947635.39981, 'timestamp_tcp_setup': 1623947635.4746208, 'pee…
[::1]:65101:   !> DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101:     >! DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101:   >> Reply(TlsStartHook(data=TlsStartData(conn=Server({'id': '…2c6973', 'address': ('pop.gmail.com', 995), 'state': <ConnectionState.OPEN: 3>, 'sni': 'pop.gmail.com', 'tls': True, 'timestamp_start': 1623947635.39981, 'timestamp_tcp_setup': 1623947635.4746208, 'peername': ('172.217.193.108', 995), 'sockname': ('192.168.86.222', 65102), 'alpn_offers': []}), context=<mitmproxy.proxy.context.Context object at 0x112e57880>, ssl_conn=<OpenSSL.SSL.Connection object at 0x112e7ea30>)),None)
[::1]:65101:     >> Reply(TlsStartHook(data=TlsStartData(conn=Server({'id': '…2c6973', 'address': ('pop.gmail.com', 995), 'state': <ConnectionState.OPEN: 3>, 'sni': 'pop.gmail.com', 'tls': True, 'timestamp_start': 1623947635.39981, 'timestamp_tcp_setup': 1623947635.4746208…
[::1]:65101:     << SendData(server, b"\x16\x03\x01\x01.\x01\x00\x01*\x03\x03\xf5z4\x7fG\x08)(\x08SZ\xba\x9b\x9e\x9dD\xf0Ixw\xe7\x0e\x0e\x0b\x0e\x92,\xaeG[\x94\xcd p\xfd`\xa3\xf9/\x9e\x11\xa5*ias\xf74\x1cgO\xbc\xba\xbc\xfd\xa2\xf2\x02(\xef4\x1f\xf2\x83\xa5\x00:\x13\x02\x13\x03\x13\x01\xc0+\xc0/\xc0,\xc00\xcc\xa9\xcc\xa8\x00\x9e\x00\x9f\xcc\xaa\xc0#\xc0'\xc0\t\xc0\x13\xc0$\xc0(\xc0\n\xc0\x14\x00g\x00k\x00\x9c\x00\x9d\x00<\x00=\x00/\x005\x00\xff\x01\x00\x00\xa7\x00\x00\x00\x12\x00\x10\x00\x00\rpop.gmail.com\x00\x0b\x00\x04\x0…
[::1]:65101:   << SendData(server, b"\x16\x03\x01\x01.\x01\x00\x01*\x03\x03\xf5z4\x7fG\x08)(\x08SZ\xba\x9b\x9e\x9dD\xf0Ixw\xe7\x0e\x0e\x0b\x0e\x92,\xaeG[\x94\xcd p\xfd`\xa3\xf9/\x9e\x11\xa5*ias\xf74\x1cgO\xbc\xba\xbc\xfd\xa2\xf2\x02(\xef4\x1f\xf2\x83\xa5\x00:\x13\x02\x13…
[::1]:65101:     !> DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101:   >> DataReceived(server, b'\x16\x03\x03\x00z\x02\x00\x00v\x03\x03\x97jY\x87\xf0\xe4C\x8c?\xd1\x98>\x0b\x16\x11\xf9\xcfz\xe5R\x85\x83p\xd1\xa7e\xeb\x81N,8I p\xfd`\xa3\xf9/\x9e\x11\xa5*ias\xf74\x1cgO\xbc\xba\xbc\xfd\xa2\xf2\x02(\xef4\x1f\xf2\x83\xa5\x13\x02\x00\x00.\x003\x00$\x00\x1d\x00 \xd1,\xfc\xcaeS\x9c`0tQ\xa8\x8d\xbd2\xb0b\xae\x8a\xae\xac\x8cAS\xe7\x153\xebl2\x8cB\x00+\x00\x02\x03\x04\x14\x03\x03\x00\x01\x01\x17\x03\x03\t\xc5\x0e\xcfDu\n\xca\xccv%\xe2\xc5\xd3!\xad\x9a\xe6\xf9\x90\xda6\x06,5\xeb a\xe6~\xd…
[::1]:65101:     >> DataReceived(server, b'\x16\x03\x03\x00z\x02\x00\x00v\x03\x03\x97jY\x87\xf0\xe4C\x8c?\xd1\x98>\x0b\x16\x11\xf9\xcfz\xe5R\x85\x83p\xd1\xa7e\xeb\x81N,8I p\xfd`\xa3\xf9/\x9e\x11\xa5*ias\xf74\x1cgO\xbc\xba\xbc\xfd\xa2\xf2\x02(\xef4\x1f\xf2\x83\xa5\x13\x02\x…
[::1]:65101:     [tls] tls established: Server(pop.gmail.com:995, state=open, tls, src_port=65102)
[::1]:65101:     << SendData(server, b'\x14\x03\x03\x00\x01\x01\x17\x03\x03\x00Er\xef\xed\xcd=\x8f7\x8b\nl\xb2Sn\xdc\xc7*i\x05\xa5\xb7\x02%Ur}\xade\x05\xa1\x0e\x8ed\xa5\xec\x9d\x8b\x1a9&O\xac)*\xbe\xf1]\xce\x1a{\xf8\x95\xf9\x89\xc6\xe4\x14\x94\xacy/\xc8D\xa8\xb3e\x1do\x85\xaa')
[::1]:65101:   << SendData(server, b'\x14\x03\x03\x00\x01\x01\x17\x03\x03\x00Er\xef\xed\xcd=\x8f7\x8b\nl\xb2Sn\xdc\xc7*i\x05\xa5\xb7\x02%Ur}\xade\x05\xa1\x0e\x8ed\xa5\xec\x9d\x8b\x1a9&O\xac)*\xbe\xf1]\xce\x1a{\xf8\x95\xf9\x89\xc6\xe4\x14\x94\xacy/\xc8D\xa8\xb3e\x1do\x85\…
[::1]:65101:       >> Start({})
[::1]:65101:       >> DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101:       << NextLayerHook(data=NextLayer:None)
[::1]:65101:     << NextLayerHook(data=NextLayer:None)
[::1]:65101:   << NextLayerHook(data=NextLayer:None)
[::1]:65101:   >> Reply(NextLayerHook(data=NextLayer:ServerTLSLayer(inactive pop.gmail.com b'')),None)
[::1]:65101:     >> Reply(NextLayerHook(data=NextLayer:ServerTLSLayer(inactive pop.gmail.com b'')),None)
[::1]:65101:       >> Reply(NextLayerHook(data=NextLayer:ServerTLSLayer(inactive pop.gmail.com b'')),None)
[::1]:65101:       [nextlayer] ServerTLSLayer(inactive pop.gmail.com b'')
[::1]:65101:       >> Start({})
[::1]:65101:         >> Start({})
[::1]:65101:       >> DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101:         >> DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0…
[::1]:65101:         << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=False))
[::1]:65101:       << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=False))
[::1]:65101:       << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=False))
[::1]:65101:     << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=False))
[::1]:65101:   << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=False))
[::1]:65101:   >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=True)),None)
[::1]:65101:     >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=True)),None)
[::1]:65101:       >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=True)),None)
[::1]:65101:         >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=True)),None)
[::1]:65101:         << TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'alpn_offers': []}), context=<mitmproxy.proxy.context.Context object at 0x112e57880>, ssl_conn=None))
[::1]:65101:       << TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'al…
[::1]:65101:     << TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'al…
[::1]:65101:   << TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'al…
[::1]:65101:   >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'alpn_offers': []}), context=<mitmproxy.proxy.context.Context object at 0x112e57880>, ssl_conn=<OpenSSL.SSL.Connection object at 0x112ea0550>)),None)
[::1]:65101:     >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost…
[::1]:65101:       >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost…
[::1]:65101:         >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost…
[::1]:65101:         << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03\x0b\xb1\x94\x7f\xf3tQ$P\xc1\x92\xfeq%\xa1\xea\xb3F+-.\xb2\xf8\xd8DOWNGRD\x01 `\xd1\xdc\xe2\xd9\xc9\x00\xd0R\x828\x13\xddn7\xd7?\x14\xd6+\x95\x8e\x926W\xa5\t\xb7\xebzR\xf9\xc0/\x00\x00\x11\xff\x01\x00\x01\x00\x00\x0b\x00\x04\x03\x00\x01\x02\x00\x17\x00\x00\x16\x03\x03\x03-\x0b\x00\x03)\x00\x03&\x00\x03#0\x82\x03\x1f0\x82\x02\x07\xa0\x03\x02\x01\x02\x02\x14?k\xa4\x82\x87\xc9aA\x14\x80\xf7\x99Nd\x00\xa5DL}.0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x0…
[::1]:65101:       << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03\x0b\xb1\x94\x7f\xf3tQ$P\xc1\x92\xfeq%\xa1\xea\xb3F+-.\xb2\xf8\xd8DOWNGRD\x01 `\xd1\xdc\xe2\xd9\xc9\x00\xd0R\x828\x13\xddn7\xd7?\x14\xd6+\x95\x8e\x926W\xa5\t\xb7\xebzR\xf9\xc0/\x00\x00\x11\xff\x01…
[::1]:65101:     << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03\x0b\xb1\x94\x7f\xf3tQ$P\xc1\x92\xfeq%\xa1\xea\xb3F+-.\xb2\xf8\xd8DOWNGRD\x01 `\xd1\xdc\xe2\xd9\xc9\x00\xd0R\x828\x13\xddn7\xd7?\x14\xd6+\x95\x8e\x926W\xa5\t\xb7\xebzR\xf9\xc0/\x00\x00\x11\xff\x01…
[::1]:65101:   << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03\x0b\xb1\x94\x7f\xf3tQ$P\xc1\x92\xfeq%\xa1\xea\xb3F+-.\xb2\xf8\xd8DOWNGRD\x01 `\xd1\xdc\xe2\xd9\xc9\x00\xd0R\x828\x13\xddn7\xd7?\x14\xd6+\x95\x8e\x926W\xa5\t\xb7\xebzR\xf9\xc0/\x00\x00\x11\xff\x01…
[::1]:65101:   >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04I\x1e\xfa~\xd6\xf6\xeb\xe7\x1b\xdc\xa6_\xba\x97D\xa7\xf8v(\x92\x12\xdc\xdf\xe8|\x87\x91\xac\\(iJ,\xb3x$\x89h\x0fY\xfc\xfc:\x95d\xe4\xffK4A\x9d\xecV\xc0\xef\x81\x0e\x11M\xaa\xb8\x0e\xaek\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(\xc3\xb1\x19\x14\x01v\xeb\xa3^\x14+\xcc\xd7\x9b\xeb:\xe3\xe0<\x1f\xd3p\xb8I&\xc4\x01\xd8\xd0&3\xa9x}\xc7\xefye\xf8\xc2')
[::1]:65101:     >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04I\x1e\xfa~\xd6\xf6\xeb\xe7\x1b\xdc\xa6_\xba\x97D\xa7\xf8v(\x92\x12\xdc\xdf\xe8|\x87\x91\xac\\(iJ,\xb3x$\x89h\x0fY\xfc\xfc:\x95d\xe4\xffK4A\x9d\xecV\xc0\xef\x81\x0e\x11M\xaa\xb8\x0e\xaek\x14\x03\x…
[::1]:65101:       >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04I\x1e\xfa~\xd6\xf6\xeb\xe7\x1b\xdc\xa6_\xba\x97D\xa7\xf8v(\x92\x12\xdc\xdf\xe8|\x87\x91\xac\\(iJ,\xb3x$\x89h\x0fY\xfc\xfc:\x95d\xe4\xffK4A\x9d\xecV\xc0\xef\x81\x0e\x11M\xaa\xb8\x0e\xaek\x14\x03\x…
[::1]:65101:         >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04I\x1e\xfa~\xd6\xf6\xeb\xe7\x1b\xdc\xa6_\xba\x97D\xa7\xf8v(\x92\x12\xdc\xdf\xe8|\x87\x91\xac\\(iJ,\xb3x$\x89h\x0fY\xfc\xfc:\x95d\xe4\xffK4A\x9d\xecV\xc0\xef\x81\x0e\x11M\xaa\xb8\x0e\xaek\x14\x03\x…
[::1]:65101:         [tls] tls established: Client([::1]:65101, state=open, tls)
[::1]:65101:         << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(>\x95\x10=\xc5\xfb\xca|s2t\x0fvZ\xaf\xc7\xa5\ny\xfd\xf5\x93\x95\x02\x10O\x0bo\xfe\xc4\x01\xd9\x82\xb7A2;\x90\x13\xac')
[::1]:65101:       << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(>\x95\x10=\xc5\xfb\xca|s2t\x0fvZ\xaf\xc7\xa5\ny\xfd\xf5\x93\x95\x02\x10O\x0bo\xfe\xc4\x01\xd9\x82\xb7A2;\x90\x13\xac')
[::1]:65101:     << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(>\x95\x10=\xc5\xfb\xca|s2t\x0fvZ\xaf\xc7\xa5\ny\xfd\xf5\x93\x95\x02\x10O\x0bo\xfe\xc4\x01\xd9\x82\xb7A2;\x90\x13\xac')
[::1]:65101:   << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(>\x95\x10=\xc5\xfb\xca|s2t\x0fvZ\xaf\xc7\xa5\ny\xfd\xf5\x93\x95\x02\x10O\x0bo\xfe\xc4\x01\xd9\x82\xb7A2;\x90\x13\xac')
[::1]:65101:           >> Start({})
[::1]:65101:   >> DataReceived(server, b"\x17\x03\x03\x02\x15\x1f\x0f\xb7\xef\x12\xe1\x122~\xf0\x98\xe3\x1c2\x99\x88\x84\x96\xe2]n\x9c\xf6P\x12C\x825\x83\x1c>_\xa6\xa9\x90\x8f\x92\xc8Q\x1e#\xef\xe5.\xfa\xf6L\x7f\xc7Q\x83d\xe2\x01\xab)\xa1\xbd\xd8\xb2\xe7\xfa\xdcM\xfe\xde'\xb9\xe5\x07\n\xdcR_\xbb\xc2\x81\x84k/\xe3\xd0N\xcc\x98\x03\xc7\xa4g\xa6\xe8_A$\xd8\xbf[\x95\xe1s\xea\xc6\xbb\xbe\xdb\x7f\x8d\x04[\xe8\xe30\x8a\xc6\x84\x1c\x0b\x88\x95\xcc\x13u$s\x1a\x01\xeb\xcf\xf9\r/\xdf\x19\xa8a\x17w\xc5\xdf\xe7!\\c\x1c\xc9\x9a\xb2\x0e…
[::1]:65101:     >> DataReceived(server, b"\x17\x03\x03\x02\x15\x1f\x0f\xb7\xef\x12\xe1\x122~\xf0\x98\xe3\x1c2\x99\x88\x84\x96\xe2]n\x9c\xf6P\x12C\x825\x83\x1c>_\xa6\xa9\x90\x8f\x92\xc8Q\x1e#\xef\xe5.\xfa\xf6L\x7f\xc7Q\x83d\xe2\x01\xab)\xa1\xbd\xd8\xb2\xe7\xfa\xdcM\xfe\xde…
[::1]:65101:       >> DataReceived(server, b'+OK Gpop ready for requests from 24.137.254.57 p23mb49974932uao\r\n')
[::1]:65101: mitmproxy has crashed!
Traceback (most recent call last):
  File "mitmproxy/proxy/server.py", line 279, in server_event
  File "mitmproxy/proxy/layer.py", line 168, in handle_event
  File "mitmproxy/proxy/layer.py", line 168, in handle_event
  File "mitmproxy/proxy/tunnel.py", line 72, in _handle_event
  File "mitmproxy/proxy/layers/tls.py", line 240, in receive_data
  File "mitmproxy/proxy/layers/tls.py", line 306, in event_to_child
  File "mitmproxy/proxy/tunnel.py", line 104, in event_to_child
  File "mitmproxy/proxy/layer.py", line 144, in handle_event
  File "mitmproxy/proxy/tunnel.py", line 72, in _handle_event
  File "mitmproxy/proxy/layers/tls.py", line 225, in receive_data
AttributeError: 'NoneType' object has no attribute 'bio_write'
```
Thanks, this is super helpful! I'll take a look later today.
also crashing on SMTP. from the mail client:

```console
INITIATING CONNECTION Jun 17 12:49:46.234 host:localhost -- port:8282 -- socket:0x0 -- thread:0x600003691340

CONNECTED Jun 17 12:49:46.479 [kCFStreamSocketSecurityLevelTLSv1_2] -- host:localhost -- port:8282 -- socket:0x600000ac0180 -- thread:0x600003691340
```

mitmdump:

```console
% ./mitmdump --mode reverse:https://smtp.gmail.com:465 --set connection_strategy=eager -p8282 -vvv --set proxy_debug=true
Proxy server listening at http://*:8282
[::1]:50064: client connect
[::1]:50064:   >> Start({})
[::1]:50064:   << NextLayerHook(data=NextLayer:None)
[::1]:50064:   >> Reply(NextLayerHook(data=NextLayer:ReverseProxy()),None)
[::1]:50064:   [nextlayer] ReverseProxy()
[::1]:50064:   >> Start({})
[::1]:50064:   << OpenConnection({'connection': Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'smtp.gmail.com', 'tls': True})})
[::1]:50064:   << OpenConnection({'connection': Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'smtp.gmail.com', 'tls': True})})
[::1]:50064: server connect smtp.gmail.com (172.217.204.109:465)
[::1]:50064:   >> Reply(OpenConnection({'connection': Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50065)})}),None)
[::1]:50064:     >> Start({})
[::1]:50064:     << TlsStartHook(data=TlsStartData(conn=Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50065)}), context=<mitmproxy.proxy.context.Context object at 0x10f8cb850>, ssl_conn=None))
[::1]:50064:   << TlsStartHook(data=TlsStartData(conn=Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, '…
[::1]:50064:   >> Reply(TlsStartHook(data=TlsStartData(conn=Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50065), 'alpn_offers': []}), context=<mitmproxy.proxy.context.Context object at 0x10f8cb850>, ssl_conn=<OpenSSL.SSL.Connection object at 0x10f8f4490>)),None)
[::1]:50064:     >> Reply(TlsStartHook(data=TlsStartData(conn=Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521…
[::1]:50064:     << SendData(server, b"\x16\x03\x01\x01/\x01\x00\x01+\x03\x03\x19\xe5\xff\x80d*\x14\x06\x1e\xf1\r\xe3\xb7\xf6\x7f\xe5G\xceH\x82bre\xc9\xf1B\x82#\xa5\x00\xfb\x89 G\x88\xbe\xb3\x06\x9c\x9d\x1f\xd6xO\x8eC+\x08|b\xbb\xbaa\t\xee\xa1\xea\xf1\xc5P\xaf\xe4\xda\xd4\xdd\x00:\x13\x02\x13\x03\x13\x01\xc0+\xc0/\xc0,\xc00\xcc\xa9\xcc\xa8\x00\x9e\x00\x9f\xcc\xaa\xc0#\xc0'\xc0\t\xc0\x13\xc0$\xc0(\xc0\n\xc0\x14\x00g\x00k\x00\x9c\x00\x9d\x00<\x00=\x00/\x005\x00\xff\x01\x00\x00\xa8\x00\x00\x00\x13\x00\x11\x00\x00\x0esmtp.gmail…
[::1]:50064:   << SendData(server, b"\x16\x03\x01\x01/\x01\x00\x01+\x03\x03\x19\xe5\xff\x80d*\x14\x06\x1e\xf1\r\xe3\xb7\xf6\x7f\xe5G\xceH\x82bre\xc9\xf1B\x82#\xa5\x00\xfb\x89 G\x88\xbe\xb3\x06\x9c\x9d\x1f\xd6xO\x8eC+\x08|b\xbb\xbaa\t\xee\xa1\xea\xf1\xc5P\xaf\xe4\xda\xd4\…
[::1]:50064:   >> DataReceived(server, b'\x16\x03\x03\x00z\x02\x00\x00v\x03\x03\xa6\xc4\x8b,\n\x16\xc0\xba\xa7\xd3v\xc1\x89k\xe7\xc6\xfb\xb5\xcb\x9b3\xabac\x95\x00\xde\xa1\x1bm\xa5\x94 G\x88\xbe\xb3\x06\x9c\x9d\x1f\xd6xO\x8eC+\x08|b\xbb\xbaa\t\xee\xa1\xea\xf1\xc5P\xaf\xe4\xda\xd4\xdd\x13\x02\x00\x00.\x003\x00$\x00\x1d\x00 \x94Ry\x13\xeb\xe4\xf3\r\x81\xb6\x90\xff\xe8\x12X\x16\x12\xab)\x93|}\xb5\xf0U\x1f\xa20I\xd3\xbd\x19\x00+\x00\x02\x03\x04\x14\x03\x03\x00\x01\x01\x17\x03\x03\t\xc7\xda\xb3\x8f\xe4N#\x10m\xb2\xaf\xb3\xecN\…
[::1]:50064:     >> DataReceived(server, b'\x16\x03\x03\x00z\x02\x00\x00v\x03\x03\xa6\xc4\x8b,\n\x16\xc0\xba\xa7\xd3v\xc1\x89k\xe7\xc6\xfb\xb5\xcb\x9b3\xabac\x95\x00\xde\xa1\x1bm\xa5\x94 G\x88\xbe\xb3\x06\x9c\x9d\x1f\xd6xO\x8eC+\x08|b\xbb\xbaa\t\xee\xa1\xea\xf1\xc5P\xaf\xe…
[::1]:50064:     [tls] tls established: Server(smtp.gmail.com:465, state=open, tls, src_port=50065)
[::1]:50064:     << SendData(server, b'\x14\x03\x03\x00\x01\x01\x17\x03\x03\x00E\x15\xc2j\xf0\x90Q\x1d\xed\x83\x98\x84\xae\x16\xbc\x7f\xee\xedk\xf7\x8d)2^}\rM\x95\xda\x19\xc2\nX\xd0a\x04\xcc\xbbK\xff\xda\xbct\x1a&}:m\xedc\x0b\n\xda*\x88\x19\xe6\xa8\xf9\x82\xf3\xe4\xd7\xd3\xf3Q"\xd5\x1e\xba')
[::1]:50064:   << SendData(server, b'\x14\x03\x03\x00\x01\x01\x17\x03\x03\x00E\x15\xc2j\xf0\x90Q\x1d\xed\x83\x98\x84\xae\x16\xbc\x7f\xee\xedk\xf7\x8d)2^}\rM\x95\xda\x19\xc2\nX\xd0a\x04\xcc\xbbK\xff\xda\xbct\x1a&}:m\xedc\x0b\n\xda*\x88\x19\xe6\xa8\xf9\x82\xf3\xe4\xd7\xd3\…
[::1]:50064:       >> Start({})
[::1]:50064:   >> DataReceived(server, b'\x17\x03\x03\x02\x15cc]\x846\xa1\x15\xd4lZC"hr\xd6\xfb"\xa6\x14S\xa752V}F@\x8d\x8eg\xde\xaf\x15M\xf4r\x86F\x0em\rE[}w\x94^?f/\x88\x89\xce,\xbf!\n\xd8\x87\r\xe0\x01\xa4T][B\xa0\x7fu\x7f\xbb-\x1e\xfaU\x1f\xa7\x99\xa8o$\x899\x15k\x9a\xf1_Q\xb3\x17\x00\xcbr\xd7\x8f\xeb\xedb.<\xc5\x1c\xd4\x81\xd2G\xf8.\x00U$\xf4\xf0\xaa\x8b\xdf~Nd\x04\xdaL\xd5\xb3-\xcetJ\xa35B\x10^\xe0\x12!\xff$vy\xeb\xab8\t\x04d\x92B\xb2\xbe,\xc7*\x86\xe9+N*\x85_\xde\x91Z\n\xf8}\x95Wl\xcc\x91\xc2\xc9\xa3J59\xe7}e\xae\x…
[::1]:50064:     >> DataReceived(server, b'\x17\x03\x03\x02\x15cc]\x846\xa1\x15\xd4lZC"hr\xd6\xfb"\xa6\x14S\xa752V}F@\x8d\x8eg\xde\xaf\x15M\xf4r\x86F\x0em\rE[}w\x94^?f/\x88\x89\xce,\xbf!\n\xd8\x87\r\xe0\x01\xa4T][B\xa0\x7fu\x7f\xbb-\x1e\xfaU\x1f\xa7\x99\xa8o$\x899\x15k\x9a…
[::1]:50064:       >> DataReceived(server, b'220 smtp.gmail.com ESMTP k15sm878177uaq.19 - gsmtp\r\n')
[::1]:50064:       << NextLayerHook(data=NextLayer:None)
[::1]:50064:     << NextLayerHook(data=NextLayer:None)
[::1]:50064:   << NextLayerHook(data=NextLayer:None)
[::1]:50064:   >> Reply(NextLayerHook(data=NextLayer:TCPLayer(state: start)),None)
[::1]:50064:     >> Reply(NextLayerHook(data=NextLayer:TCPLayer(state: start)),None)
[::1]:50064:       >> Reply(NextLayerHook(data=NextLayer:TCPLayer(state: start)),None)
[::1]:50064:       [nextlayer] TCPLayer(state: start)
[::1]:50064:       >> Start({})
[::1]:50064:       << TcpStartHook(flow=<TCPFlow (0 messages)>)
[::1]:50064:       << TcpStartHook(flow=<TCPFlow (0 messages)>)
[::1]:50064:     << TcpStartHook(flow=<TCPFlow (0 messages)>)
[::1]:50064:   << TcpStartHook(flow=<TCPFlow (0 messages)>)
[::1]:50064:       >! DataReceived(server, b'220 smtp.gmail.com ESMTP k15sm878177uaq.19 - gsmtp\r\n')
[::1]:50064:   >> Reply(TcpStartHook(flow=<TCPFlow (0 messages)>),None)
[::1]:50064:     >> Reply(TcpStartHook(flow=<TCPFlow (0 messages)>),None)
[::1]:50064:       >> Reply(TcpStartHook(flow=<TCPFlow (0 messages)>),None)
[::1]:50064:       !> DataReceived(server, b'220 smtp.gmail.com ESMTP k15sm878177uaq.19 - gsmtp\r\n')
[::1]:50064:       << TcpMessageHook(flow=<TCPFlow (1 messages)>)
[::1]:50064:     << TcpMessageHook(flow=<TCPFlow (1 messages)>)
[::1]:50064:   << TcpMessageHook(flow=<TCPFlow (1 messages)>)
[::1]:50064 <- tcp <- smtp.gmail.com:465
[::1]:50064:   >> Reply(TcpMessageHook(flow=<TCPFlow (1 messages)>),None)
[::1]:50064:     >> Reply(TcpMessageHook(flow=<TCPFlow (1 messages)>),None)
[::1]:50064:       >> Reply(TcpMessageHook(flow=<TCPFlow (1 messages)>),None)
[::1]:50064:       << SendData(client, b'220 smtp.gmail.com ESMTP k15sm878177uaq.19 - gsmtp\r\n')
[::1]:50064:     << SendData(client, b'220 smtp.gmail.com ESMTP k15sm878177uaq.19 - gsmtp\r\n')
[::1]:50064:   << SendData(client, b'220 smtp.gmail.com ESMTP k15sm878177uaq.19 - gsmtp\r\n')
[::1]:50064:   >> ConnectionClosed(connection=Client({'id': '…529a3f', 'peername': ('::1', 50064, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948574.192099, 'state': <ConnectionState.CAN_WRITE: 2>, 'reply': None}))
[::1]:50064:     >> ConnectionClosed(connection=Client({'id': '…529a3f', 'peername': ('::1', 50064, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948574.192099, 'state': <ConnectionState.CAN_WRITE: 2>, 'reply': None}))
[::1]:50064:       >> ConnectionClosed(connection=Client({'id': '…529a3f', 'peername': ('::1', 50064, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948574.192099, 'state': <ConnectionState.CAN_WRITE: 2>, 'reply': None}))
[::1]:50064:       << CloseConnection({'connection': Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50065), 'alpn_offers': [], 'timestamp_tls_setup': 1623948574.6460001, 'alpn': b'', 'certificate_list': [<mitmproxy.certs.Cert object at 0x10f8f45b0>, <mitmproxy.certs.Cert object at 0x10f8f4640…
[::1]:50064:     << CloseConnection({'connection': Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peern…
[::1]:50064:   << CloseConnection({'connection': Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peern…
[::1]:50064: half-closing Server(smtp.gmail.com:465, state=open, tls, src_port=50065)
[::1]:50064:   >> ConnectionClosed(connection=Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50065), 'alpn_offers': [], 'timestamp_tls_setup': 1623948574.6460001, 'alpn': b'', 'certificate_list': [<mitmproxy.certs.Cert object at 0x10f8f45b0>, <mitmproxy.certs.Cert object at 0x10f8f4640>…
[::1]:50064:     >> ConnectionClosed(connection=Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peerna…
[::1]:50064:       >> ConnectionClosed(connection=Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peerna…
[::1]:50064:       << CloseConnection({'connection': Client({'id': '…529a3f', 'peername': ('::1', 50064, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948574.192099, 'state': <ConnectionState.CAN_WRITE: 2>, 'reply': None}), 'half_close': False})
[::1]:50064:     << CloseConnection({'connection': Client({'id': '…529a3f', 'peername': ('::1', 50064, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948574.192099, 'state': <ConnectionState.CAN_WRITE: 2>, 'reply': None}), 'half_close': False})
[::1]:50064:   << CloseConnection({'connection': Client({'id': '…529a3f', 'peername': ('::1', 50064, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948574.192099, 'state': <ConnectionState.CAN_WRITE: 2>, 'reply': None}), 'half_close': False})
[::1]:50064:       << TcpEndHook(flow=<TCPFlow (1 messages)>)
[::1]:50064:     << TcpEndHook(flow=<TCPFlow (1 messages)>)
[::1]:50064:   << TcpEndHook(flow=<TCPFlow (1 messages)>)
[::1]:50064: server disconnect smtp.gmail.com (172.217.204.109:465)
[::1]:50064: client disconnect
[::1]:50064:   >> Reply(TcpEndHook(flow=<TCPFlow (1 messages)>),None)
[::1]:50064:     >> Reply(TcpEndHook(flow=<TCPFlow (1 messages)>),None)
[::1]:50064:       >> Reply(TcpEndHook(flow=<TCPFlow (1 messages)>),None)
[::1]:50064: closing transports...
[::1]:50064: transports closed!
[::1]:50104: client connect
[::1]:50104:   >> Start({})
[::1]:50104:   << NextLayerHook(data=NextLayer:None)
[::1]:50104:   >! DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104:   >> Reply(NextLayerHook(data=NextLayer:ReverseProxy()),None)
[::1]:50104:   [nextlayer] ReverseProxy()
[::1]:50104:   >> Start({})
[::1]:50104:   << OpenConnection({'connection': Server({'id': '…ef1b92', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'smtp.gmail.com', 'tls': True})})
[::1]:50104:   << OpenConnection({'connection': Server({'id': '…ef1b92', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'smtp.gmail.com', 'tls': True})})
[::1]:50104:   !> DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104:   >! DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104: server connect smtp.gmail.com (172.217.204.109:465)
[::1]:50104:   >> Reply(OpenConnection({'connection': Server({'id': '…ef1b92', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948586.253964, 'timestamp_tcp_setup': 1623948586.336297, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50105)})}),None)
[::1]:50104:     >> Start({})
[::1]:50104:     << TlsStartHook(data=TlsStartData(conn=Server({'id': '…ef1b92', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948586.253964, 'timestamp_tcp_setup': 1623948586.336297, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50105)}), context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, ssl_conn=None))
[::1]:50104:   << TlsStartHook(data=TlsStartData(conn=Server({'id': '…ef1b92', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948586.253964, 'timestamp_tcp_setup': 1623948586.336297, 'p…
[::1]:50104:   !> DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104:     >! DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104:   >> Reply(TlsStartHook(data=TlsStartData(conn=Server({'id': '…ef1b92', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948586.253964, 'timestamp_tcp_setup': 1623948586.336297, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50105), 'alpn_offers': []}), context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, ssl_conn=<OpenSSL.SSL.Connection object at 0x10f9173d0>)),None)
[::1]:50104:     >> Reply(TlsStartHook(data=TlsStartData(conn=Server({'id': '…ef1b92', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948586.253964, 'timestamp_tcp_setup': 1623948586.3362…
[::1]:50104:     << SendData(server, b'\x16\x03\x01\x01/\x01\x00\x01+\x03\x03\xcf\xd6\xdc\xb2\xd2\x17\xc1R\xdf\x1c\xb7\x1c\xa3\xd7f\xef\xb7R\x02a-\xfb\xb6c\xa2\xecn\x81\xba\xf9\x88\xc6 -~\x16\xd6\xd2\xc9\x10\x88`\xeeq\x1dG\x8c\xb6\xed"\x9a\x9b\xb6\x15\x12\xdb\xd7i\x89k(J\xa1#q\x00:\x13\x02\x13\x03\x13\x01\xc0+\xc0/\xc0,\xc00\xcc\xa9\xcc\xa8\x00\x9e\x00\x9f\xcc\xaa\xc0#\xc0\'\xc0\t\xc0\x13\xc0$\xc0(\xc0\n\xc0\x14\x00g\x00k\x00\x9c\x00\x9d\x00<\x00=\x00/\x005\x00\xff\x01\x00\x00\xa8\x00\x00\x00\x13\x00\x11\x00\x00\x0esmtp.gma…
[::1]:50104:   << SendData(server, b'\x16\x03\x01\x01/\x01\x00\x01+\x03\x03\xcf\xd6\xdc\xb2\xd2\x17\xc1R\xdf\x1c\xb7\x1c\xa3\xd7f\xef\xb7R\x02a-\xfb\xb6c\xa2\xecn\x81\xba\xf9\x88\xc6 -~\x16\xd6\xd2\xc9\x10\x88`\xeeq\x1dG\x8c\xb6\xed"\x9a\x9b\xb6\x15\x12\xdb\xd7i\x89k(J\x…
[::1]:50104:     !> DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104:   >> DataReceived(server, b'\x16\x03\x03\x00z\x02\x00\x00v\x03\x03\\\x93\x98\x8eM\x06\x98\x90I\xe8Z`\xb1\xf0V\x10\xd9"\x9aME\n\xfe\xa0\xb6\xb6\xa9\xc6\xe8\xce\xa0e -~\x16\xd6\xd2\xc9\x10\x88`\xeeq\x1dG\x8c\xb6\xed"\x9a\x9b\xb6\x15\x12\xdb\xd7i\x89k(J\xa1#q\x13\x02\x00\x00.\x003\x00$\x00\x1d\x00 K\x03\xcd6\x88g\xf7\x90\xd8\xc4\x9f\x11\xf8\xd9[_egOb\x881)\x80\\\xc6}0L\x83\x01\x15\x00+\x00\x02\x03\x04\x14\x03\x03\x00\x01\x01\x17\x03\x03\t\xc5\xb2\x92\x97\x83\xf6bS\xd3\x95C\x17\xe5\x1d%\xd2\xc2W\x16\xa6\x05\xdd\x…
[::1]:50104:     >> DataReceived(server, b'\x16\x03\x03\x00z\x02\x00\x00v\x03\x03\\\x93\x98\x8eM\x06\x98\x90I\xe8Z`\xb1\xf0V\x10\xd9"\x9aME\n\xfe\xa0\xb6\xb6\xa9\xc6\xe8\xce\xa0e -~\x16\xd6\xd2\xc9\x10\x88`\xeeq\x1dG\x8c\xb6\xed"\x9a\x9b\xb6\x15\x12\xdb\xd7i\x89k(J\xa1#q\x…
[::1]:50104:     [tls] tls established: Server(smtp.gmail.com:465, state=open, tls, src_port=50105)
[::1]:50104:     << SendData(server, b'\x14\x03\x03\x00\x01\x01\x17\x03\x03\x00E\xa8\xfa\xaeH\xa8J\x85\xb6w4S\xc1\xa3\xebT"\x00*i\xab\x04a\xc4\x04,\xcc\xfb\xbb\xc5d\xe1\xc3\x81{\\\xd0<\x16s\xf7\xb2!\xb93\n=\x85!\xb1\x9d\xc0\xb6\xfb\xf3\xcd7\xa9\xb8\xde^{.\xd2\xf0\xaa\xeb\x15\x98\xe2')
[::1]:50104:   << SendData(server, b'\x14\x03\x03\x00\x01\x01\x17\x03\x03\x00E\xa8\xfa\xaeH\xa8J\x85\xb6w4S\xc1\xa3\xebT"\x00*i\xab\x04a\xc4\x04,\xcc\xfb\xbb\xc5d\xe1\xc3\x81{\\\xd0<\x16s\xf7\xb2!\xb93\n=\x85!\xb1\x9d\xc0\xb6\xfb\xf3\xcd7\xa9\xb8\xde^{.\xd2\xf0\xaa\xeb\x…
[::1]:50104:       >> Start({})
[::1]:50104:       >> DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104:       << NextLayerHook(data=NextLayer:None)
[::1]:50104:     << NextLayerHook(data=NextLayer:None)
[::1]:50104:   << NextLayerHook(data=NextLayer:None)
[::1]:50104:   >> Reply(NextLayerHook(data=NextLayer:ServerTLSLayer(inactive smtp.gmail.com b'')),None)
[::1]:50104:     >> Reply(NextLayerHook(data=NextLayer:ServerTLSLayer(inactive smtp.gmail.com b'')),None)
[::1]:50104:       >> Reply(NextLayerHook(data=NextLayer:ServerTLSLayer(inactive smtp.gmail.com b'')),None)
[::1]:50104:       [nextlayer] ServerTLSLayer(inactive smtp.gmail.com b'')
[::1]:50104:       >> Start({})
[::1]:50104:         >> Start({})
[::1]:50104:       >> DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104:         >> DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1…
[::1]:50104:         << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=False))
[::1]:50104:       << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=False))
[::1]:50104:       << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=False))
[::1]:50104:     << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=False))
[::1]:50104:   << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=False))
[::1]:50104:   >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=True)),None)
[::1]:50104:     >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=True)),None)
[::1]:50104:       >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=True)),None)
[::1]:50104:         >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=True)),None)
[::1]:50104:         << TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'alpn_offers': []}), context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, ssl_conn=None))
[::1]:50104:       << TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'a…
[::1]:50104:     << TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'a…
[::1]:50104:   << TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'a…
[::1]:50104:   >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'alpn_offers': []}), context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, ssl_conn=<OpenSSL.SSL.Connection object at 0x10f928e80>)),None)
[::1]:50104:     >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhos…
[::1]:50104:       >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhos…
[::1]:50104:         >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhos…
[::1]:50104:         << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03*\x8e\xcd\xd4\xb3+E\xd49v\x05s\xb2\xcd\xa3\xfa\xc4\xce!\xea_\x8b"IDOWNGRD\x01 \xdd\x03\xbcu`\xa0\x1f\xaf\xb1\xdc\x15g\xeb\x15\xa3\xf8\x9e\xb2q\x9e\xccA\xd9\xb0\x1e3\t\x87\xa8\xd4\x93?\xc0/\x00\x00\x11\xff\x01\x00\x01\x00\x00\x0b\x00\x04\x03\x00\x01\x02\x00\x17\x00\x00\x16\x03\x03\x03/\x0b\x00\x03+\x00\x03(\x00\x03%0\x82\x03!0\x82\x02\t\xa0\x03\x02\x01\x02\x02\x14\x1b\xbcbs\x95tRF_\x88d\xee\xb4fZ\xaf\x8e}\xfa/0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x0…
[::1]:50104:       << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03*\x8e\xcd\xd4\xb3+E\xd49v\x05s\xb2\xcd\xa3\xfa\xc4\xce!\xea_\x8b"IDOWNGRD\x01 \xdd\x03\xbcu`\xa0\x1f\xaf\xb1\xdc\x15g\xeb\x15\xa3\xf8\x9e\xb2q\x9e\xccA\xd9\xb0\x1e3\t\x87\xa8\xd4\x93?\xc0/\x00\x00…
[::1]:50104:     << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03*\x8e\xcd\xd4\xb3+E\xd49v\x05s\xb2\xcd\xa3\xfa\xc4\xce!\xea_\x8b"IDOWNGRD\x01 \xdd\x03\xbcu`\xa0\x1f\xaf\xb1\xdc\x15g\xeb\x15\xa3\xf8\x9e\xb2q\x9e\xccA\xd9\xb0\x1e3\t\x87\xa8\xd4\x93?\xc0/\x00\x00…
[::1]:50104:   << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03*\x8e\xcd\xd4\xb3+E\xd49v\x05s\xb2\xcd\xa3\xfa\xc4\xce!\xea_\x8b"IDOWNGRD\x01 \xdd\x03\xbcu`\xa0\x1f\xaf\xb1\xdc\x15g\xeb\x15\xa3\xf8\x9e\xb2q\x9e\xccA\xd9\xb0\x1e3\t\x87\xa8\xd4\x93?\xc0/\x00\x00…
[::1]:50104:   >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04\xf5\xfd\xd2\xb8\xe4\x07cYT\x1f\xe6\xd2>\xd3\xa2\xa0Z\x82\xee\xadi)|\x0f?\xd2\xe6\xf0#\x8erY@r1\x9a\xe1T\xbc\xe6K\xb1\x0f\xf0\xa3\x1f\xcc\xa3"\xcd\x869{\xc6ap\xb9\x89j&\xc9~\xde\'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(L\x11|E\xa4\xc2\x84\xb0\xd4c\xa7"F\x11*\\\x11~\xa8o\xf0"\x9e\x80^-e\x86\xf8\x10\xa2\xe2_\xf8\x0f%\xd2\x08&\xcf')
[::1]:50104:     >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04\xf5\xfd\xd2\xb8\xe4\x07cYT\x1f\xe6\xd2>\xd3\xa2\xa0Z\x82\xee\xadi)|\x0f?\xd2\xe6\xf0#\x8erY@r1\x9a\xe1T\xbc\xe6K\xb1\x0f\xf0\xa3\x1f\xcc\xa3"\xcd\x869{\xc6ap\xb9\x89j&\xc9~\xde\'\x14\x03\x03\x00…
[::1]:50104:       >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04\xf5\xfd\xd2\xb8\xe4\x07cYT\x1f\xe6\xd2>\xd3\xa2\xa0Z\x82\xee\xadi)|\x0f?\xd2\xe6\xf0#\x8erY@r1\x9a\xe1T\xbc\xe6K\xb1\x0f\xf0\xa3\x1f\xcc\xa3"\xcd\x869{\xc6ap\xb9\x89j&\xc9~\xde\'\x14\x03\x03\x00…
[::1]:50104:         >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04\xf5\xfd\xd2\xb8\xe4\x07cYT\x1f\xe6\xd2>\xd3\xa2\xa0Z\x82\xee\xadi)|\x0f?\xd2\xe6\xf0#\x8erY@r1\x9a\xe1T\xbc\xe6K\xb1\x0f\xf0\xa3\x1f\xcc\xa3"\xcd\x869{\xc6ap\xb9\x89j&\xc9~\xde\'\x14\x03\x03\x00…
[::1]:50104:         [tls] tls established: Client([::1]:50104, state=open, tls)
[::1]:50104:         << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(\xd0k\x1dCX\x84C\x12t\xd8\xd6K\xda\xa0\x02s\xb6h\t?J\xe8\x15\xeb\xda\xf0\xe1\xeaZ\n\xa3M#@=\x16\xa7:\xbc\xec')
[::1]:50104:       << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(\xd0k\x1dCX\x84C\x12t\xd8\xd6K\xda\xa0\x02s\xb6h\t?J\xe8\x15\xeb\xda\xf0\xe1\xeaZ\n\xa3M#@=\x16\xa7:\xbc\xec')
[::1]:50104:     << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(\xd0k\x1dCX\x84C\x12t\xd8\xd6K\xda\xa0\x02s\xb6h\t?J\xe8\x15\xeb\xda\xf0\xe1\xeaZ\n\xa3M#@=\x16\xa7:\xbc\xec')
[::1]:50104:   << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(\xd0k\x1dCX\x84C\x12t\xd8\xd6K\xda\xa0\x02s\xb6h\t?J\xe8\x15\xeb\xda\xf0\xe1\xeaZ\n\xa3M#@=\x16\xa7:\xbc\xec')
[::1]:50104:           >> Start({})
[::1]:50104:   >> DataReceived(server, b'\x17\x03\x03\x02\x15\xb5\xb7\xb2\xd5\x0e\x8f\xd3\x0f\x87\xd2\\.\xbe\x03V\xb1\x9d_\x08\x8de$\xee\xb7\\L*\'Q\xe9\r\xb2\x04\x05\x04\xc05\xa1V;\x859\xdbq\xa2\xbd\xe8%\xef\x1a\xe7ii\x94kp\xfb\xed\xee\x93\xa8_\x9eR\x1d\n\xd1D\xe4\x91\xc8\xf4\x16\xf8\xf9\xfb[:\x82r"[\xa4\x89\x10[w6\x99\xe5\xa5\xe9\x0c\xf6\xc9n\x17\xc3\xd7v\x06\xd4\xc9\x06\xb7R>%\x81\x03\x9f5qI\t\x8b\xa14\x9e\x8e+\xdb\x1d\x9f<\xa0\x19+%\xd5;\xc2\xd3\xa0\x8c7\xa5\xfcWY0\xc9A\xeap\xa7kd\'-\xb3H\x9d\xbc\xe4$!C\xc4B\xadG\x89g\…
[::1]:50104:     >> DataReceived(server, b'\x17\x03\x03\x02\x15\xb5\xb7\xb2\xd5\x0e\x8f\xd3\x0f\x87\xd2\\.\xbe\x03V\xb1\x9d_\x08\x8de$\xee\xb7\\L*\'Q\xe9\r\xb2\x04\x05\x04\xc05\xa1V;\x859\xdbq\xa2\xbd\xe8%\xef\x1a\xe7ii\x94kp\xfb\xed\xee\x93\xa8_\x9eR\x1d\n\xd1D\xe4\x91\xc…
[::1]:50104:       >> DataReceived(server, b'220 smtp.gmail.com ESMTP e19sm712405uaa.16 - gsmtp\r\n')
[::1]:50104: mitmproxy has crashed!
Traceback (most recent call last):
  File "mitmproxy/proxy/server.py", line 279, in server_event
  File "mitmproxy/proxy/layer.py", line 168, in handle_event
  File "mitmproxy/proxy/layer.py", line 168, in handle_event
  File "mitmproxy/proxy/tunnel.py", line 72, in _handle_event
  File "mitmproxy/proxy/layers/tls.py", line 240, in receive_data
  File "mitmproxy/proxy/layers/tls.py", line 306, in event_to_child
  File "mitmproxy/proxy/tunnel.py", line 104, in event_to_child
  File "mitmproxy/proxy/layer.py", line 144, in handle_event
  File "mitmproxy/proxy/tunnel.py", line 72, in _handle_event
  File "mitmproxy/proxy/layers/tls.py", line 225, in receive_data
AttributeError: 'NoneType' object has no attribute 'bio_write'
```
Fantastic, thanks! I can reproduce it now, which generally makes fixing much easier. :)
Thanks for testing the 7.0 snapshots! Any idea how I can reproduce this? Can you trigger this with `-vvv -set proxy_debug`? An extended log would be incredibly helpful for debugging this. Feel free to shoot me an email with your logs if you want to keep them private.
to reproduce this (if you have a mac), i'm using the Apple Mail.app. Set up a POP / SMTP account and point the POP one at localhost 8181, TLS on, password auth.

```console
./mitmdump --set termlog_verbosity=debug  --mode reverse:https://pop.gmail.com:995 --set connection_strategy=eager -w mail_debug --set flow_detail=3 -p 8181 -vvv --set proxy_debug=true
Proxy server listening at http://*:8181
[::1]:65101: client connect
[::1]:65101:   >> Start({})
[::1]:65101:   << NextLayerHook(data=NextLayer:None)
[::1]:65101:   >! DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101:   >> Reply(NextLayerHook(data=NextLayer:ReverseProxy()),None)
[::1]:65101:   [nextlayer] ReverseProxy()
[::1]:65101:   >> Start({})
[::1]:65101:   << OpenConnection({'connection': Server({'id': '…2c6973', 'address': ('pop.gmail.com', 995), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'pop.gmail.com', 'tls': True})})
[::1]:65101:   << OpenConnection({'connection': Server({'id': '…2c6973', 'address': ('pop.gmail.com', 995), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'pop.gmail.com', 'tls': True})})
[::1]:65101:   !> DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101:   >! DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101: server connect pop.gmail.com (172.217.193.108:995)
[::1]:65101:   >> Reply(OpenConnection({'connection': Server({'id': '…2c6973', 'address': ('pop.gmail.com', 995), 'state': <ConnectionState.OPEN: 3>, 'sni': 'pop.gmail.com', 'tls': True, 'timestamp_start': 1623947635.39981, 'timestamp_tcp_setup': 1623947635.4746208, 'peername': ('172.217.193.108', 995), 'sockname': ('192.168.86.222', 65102)})}),None)
[::1]:65101:     >> Start({})
[::1]:65101:     << TlsStartHook(data=TlsStartData(conn=Server({'id': '…2c6973', 'address': ('pop.gmail.com', 995), 'state': <ConnectionState.OPEN: 3>, 'sni': 'pop.gmail.com', 'tls': True, 'timestamp_start': 1623947635.39981, 'timestamp_tcp_setup': 1623947635.4746208, 'peername': ('172.217.193.108', 995), 'sockname': ('192.168.86.222', 65102)}), context=<mitmproxy.proxy.context.Context object at 0x112e57880>, ssl_conn=None))
[::1]:65101:   << TlsStartHook(data=TlsStartData(conn=Server({'id': '…2c6973', 'address': ('pop.gmail.com', 995), 'state': <ConnectionState.OPEN: 3>, 'sni': 'pop.gmail.com', 'tls': True, 'timestamp_start': 1623947635.39981, 'timestamp_tcp_setup': 1623947635.4746208, 'pee…
[::1]:65101:   !> DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101:     >! DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101:   >> Reply(TlsStartHook(data=TlsStartData(conn=Server({'id': '…2c6973', 'address': ('pop.gmail.com', 995), 'state': <ConnectionState.OPEN: 3>, 'sni': 'pop.gmail.com', 'tls': True, 'timestamp_start': 1623947635.39981, 'timestamp_tcp_setup': 1623947635.4746208, 'peername': ('172.217.193.108', 995), 'sockname': ('192.168.86.222', 65102), 'alpn_offers': []}), context=<mitmproxy.proxy.context.Context object at 0x112e57880>, ssl_conn=<OpenSSL.SSL.Connection object at 0x112e7ea30>)),None)
[::1]:65101:     >> Reply(TlsStartHook(data=TlsStartData(conn=Server({'id': '…2c6973', 'address': ('pop.gmail.com', 995), 'state': <ConnectionState.OPEN: 3>, 'sni': 'pop.gmail.com', 'tls': True, 'timestamp_start': 1623947635.39981, 'timestamp_tcp_setup': 1623947635.4746208…
[::1]:65101:     << SendData(server, b"\x16\x03\x01\x01.\x01\x00\x01*\x03\x03\xf5z4\x7fG\x08)(\x08SZ\xba\x9b\x9e\x9dD\xf0Ixw\xe7\x0e\x0e\x0b\x0e\x92,\xaeG[\x94\xcd p\xfd`\xa3\xf9/\x9e\x11\xa5*ias\xf74\x1cgO\xbc\xba\xbc\xfd\xa2\xf2\x02(\xef4\x1f\xf2\x83\xa5\x00:\x13\x02\x13\x03\x13\x01\xc0+\xc0/\xc0,\xc00\xcc\xa9\xcc\xa8\x00\x9e\x00\x9f\xcc\xaa\xc0#\xc0'\xc0\t\xc0\x13\xc0$\xc0(\xc0\n\xc0\x14\x00g\x00k\x00\x9c\x00\x9d\x00<\x00=\x00/\x005\x00\xff\x01\x00\x00\xa7\x00\x00\x00\x12\x00\x10\x00\x00\rpop.gmail.com\x00\x0b\x00\x04\x0…
[::1]:65101:   << SendData(server, b"\x16\x03\x01\x01.\x01\x00\x01*\x03\x03\xf5z4\x7fG\x08)(\x08SZ\xba\x9b\x9e\x9dD\xf0Ixw\xe7\x0e\x0e\x0b\x0e\x92,\xaeG[\x94\xcd p\xfd`\xa3\xf9/\x9e\x11\xa5*ias\xf74\x1cgO\xbc\xba\xbc\xfd\xa2\xf2\x02(\xef4\x1f\xf2\x83\xa5\x00:\x13\x02\x13…
[::1]:65101:     !> DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101:   >> DataReceived(server, b'\x16\x03\x03\x00z\x02\x00\x00v\x03\x03\x97jY\x87\xf0\xe4C\x8c?\xd1\x98>\x0b\x16\x11\xf9\xcfz\xe5R\x85\x83p\xd1\xa7e\xeb\x81N,8I p\xfd`\xa3\xf9/\x9e\x11\xa5*ias\xf74\x1cgO\xbc\xba\xbc\xfd\xa2\xf2\x02(\xef4\x1f\xf2\x83\xa5\x13\x02\x00\x00.\x003\x00$\x00\x1d\x00 \xd1,\xfc\xcaeS\x9c`0tQ\xa8\x8d\xbd2\xb0b\xae\x8a\xae\xac\x8cAS\xe7\x153\xebl2\x8cB\x00+\x00\x02\x03\x04\x14\x03\x03\x00\x01\x01\x17\x03\x03\t\xc5\x0e\xcfDu\n\xca\xccv%\xe2\xc5\xd3!\xad\x9a\xe6\xf9\x90\xda6\x06,5\xeb a\xe6~\xd…
[::1]:65101:     >> DataReceived(server, b'\x16\x03\x03\x00z\x02\x00\x00v\x03\x03\x97jY\x87\xf0\xe4C\x8c?\xd1\x98>\x0b\x16\x11\xf9\xcfz\xe5R\x85\x83p\xd1\xa7e\xeb\x81N,8I p\xfd`\xa3\xf9/\x9e\x11\xa5*ias\xf74\x1cgO\xbc\xba\xbc\xfd\xa2\xf2\x02(\xef4\x1f\xf2\x83\xa5\x13\x02\x…
[::1]:65101:     [tls] tls established: Server(pop.gmail.com:995, state=open, tls, src_port=65102)
[::1]:65101:     << SendData(server, b'\x14\x03\x03\x00\x01\x01\x17\x03\x03\x00Er\xef\xed\xcd=\x8f7\x8b\nl\xb2Sn\xdc\xc7*i\x05\xa5\xb7\x02%Ur}\xade\x05\xa1\x0e\x8ed\xa5\xec\x9d\x8b\x1a9&O\xac)*\xbe\xf1]\xce\x1a{\xf8\x95\xf9\x89\xc6\xe4\x14\x94\xacy/\xc8D\xa8\xb3e\x1do\x85\xaa')
[::1]:65101:   << SendData(server, b'\x14\x03\x03\x00\x01\x01\x17\x03\x03\x00Er\xef\xed\xcd=\x8f7\x8b\nl\xb2Sn\xdc\xc7*i\x05\xa5\xb7\x02%Ur}\xade\x05\xa1\x0e\x8ed\xa5\xec\x9d\x8b\x1a9&O\xac)*\xbe\xf1]\xce\x1a{\xf8\x95\xf9\x89\xc6\xe4\x14\x94\xacy/\xc8D\xa8\xb3e\x1do\x85\…
[::1]:65101:       >> Start({})
[::1]:65101:       >> DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101:       << NextLayerHook(data=NextLayer:None)
[::1]:65101:     << NextLayerHook(data=NextLayer:None)
[::1]:65101:   << NextLayerHook(data=NextLayer:None)
[::1]:65101:   >> Reply(NextLayerHook(data=NextLayer:ServerTLSLayer(inactive pop.gmail.com b'')),None)
[::1]:65101:     >> Reply(NextLayerHook(data=NextLayer:ServerTLSLayer(inactive pop.gmail.com b'')),None)
[::1]:65101:       >> Reply(NextLayerHook(data=NextLayer:ServerTLSLayer(inactive pop.gmail.com b'')),None)
[::1]:65101:       [nextlayer] ServerTLSLayer(inactive pop.gmail.com b'')
[::1]:65101:       >> Start({})
[::1]:65101:         >> Start({})
[::1]:65101:       >> DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0\'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x00\x06\x00\x17\x0…
[::1]:65101:         >> DataReceived(client, b'\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcbysc5\x8a \n\xf5$\tc\x81"\xa2\xf8\x90Y\xa1\xfb\xbep\x1b\x14\x8c[9N?\x87\xd9 \x8a^\x00=\xd5\x9c\xf4x\x9c\x96P\x88Y\xd6\xf1y\xc1b\xdd\xc1D\xbb\x00M\xbffE\xb9_\xd1Y\xc9\x00:\x00\xff\xc0…
[::1]:65101:         << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=False))
[::1]:65101:       << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=False))
[::1]:65101:       << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=False))
[::1]:65101:     << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=False))
[::1]:65101:   << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=False))
[::1]:65101:   >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=True)),None)
[::1]:65101:     >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=True)),None)
[::1]:65101:       >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=True)),None)
[::1]:65101:         >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x112e57880>, establish_server_tls_first=True)),None)
[::1]:65101:         << TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'alpn_offers': []}), context=<mitmproxy.proxy.context.Context object at 0x112e57880>, ssl_conn=None))
[::1]:65101:       << TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'al…
[::1]:65101:     << TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'al…
[::1]:65101:   << TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'al…
[::1]:65101:   >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'alpn_offers': []}), context=<mitmproxy.proxy.context.Context object at 0x112e57880>, ssl_conn=<OpenSSL.SSL.Connection object at 0x112ea0550>)),None)
[::1]:65101:     >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost…
[::1]:65101:       >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost…
[::1]:65101:         >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…d71470', 'peername': ('::1', 65101, 0, 0), 'sockname': ('::1', 8181, 0, 0), 'timestamp_start': 1623947635.394167, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost…
[::1]:65101:         << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03\x0b\xb1\x94\x7f\xf3tQ$P\xc1\x92\xfeq%\xa1\xea\xb3F+-.\xb2\xf8\xd8DOWNGRD\x01 `\xd1\xdc\xe2\xd9\xc9\x00\xd0R\x828\x13\xddn7\xd7?\x14\xd6+\x95\x8e\x926W\xa5\t\xb7\xebzR\xf9\xc0/\x00\x00\x11\xff\x01\x00\x01\x00\x00\x0b\x00\x04\x03\x00\x01\x02\x00\x17\x00\x00\x16\x03\x03\x03-\x0b\x00\x03)\x00\x03&\x00\x03#0\x82\x03\x1f0\x82\x02\x07\xa0\x03\x02\x01\x02\x02\x14?k\xa4\x82\x87\xc9aA\x14\x80\xf7\x99Nd\x00\xa5DL}.0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x0…
[::1]:65101:       << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03\x0b\xb1\x94\x7f\xf3tQ$P\xc1\x92\xfeq%\xa1\xea\xb3F+-.\xb2\xf8\xd8DOWNGRD\x01 `\xd1\xdc\xe2\xd9\xc9\x00\xd0R\x828\x13\xddn7\xd7?\x14\xd6+\x95\x8e\x926W\xa5\t\xb7\xebzR\xf9\xc0/\x00\x00\x11\xff\x01…
[::1]:65101:     << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03\x0b\xb1\x94\x7f\xf3tQ$P\xc1\x92\xfeq%\xa1\xea\xb3F+-.\xb2\xf8\xd8DOWNGRD\x01 `\xd1\xdc\xe2\xd9\xc9\x00\xd0R\x828\x13\xddn7\xd7?\x14\xd6+\x95\x8e\x926W\xa5\t\xb7\xebzR\xf9\xc0/\x00\x00\x11\xff\x01…
[::1]:65101:   << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03\x0b\xb1\x94\x7f\xf3tQ$P\xc1\x92\xfeq%\xa1\xea\xb3F+-.\xb2\xf8\xd8DOWNGRD\x01 `\xd1\xdc\xe2\xd9\xc9\x00\xd0R\x828\x13\xddn7\xd7?\x14\xd6+\x95\x8e\x926W\xa5\t\xb7\xebzR\xf9\xc0/\x00\x00\x11\xff\x01…
[::1]:65101:   >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04I\x1e\xfa~\xd6\xf6\xeb\xe7\x1b\xdc\xa6_\xba\x97D\xa7\xf8v(\x92\x12\xdc\xdf\xe8|\x87\x91\xac\\(iJ,\xb3x$\x89h\x0fY\xfc\xfc:\x95d\xe4\xffK4A\x9d\xecV\xc0\xef\x81\x0e\x11M\xaa\xb8\x0e\xaek\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(\xc3\xb1\x19\x14\x01v\xeb\xa3^\x14+\xcc\xd7\x9b\xeb:\xe3\xe0<\x1f\xd3p\xb8I&\xc4\x01\xd8\xd0&3\xa9x}\xc7\xefye\xf8\xc2')
[::1]:65101:     >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04I\x1e\xfa~\xd6\xf6\xeb\xe7\x1b\xdc\xa6_\xba\x97D\xa7\xf8v(\x92\x12\xdc\xdf\xe8|\x87\x91\xac\\(iJ,\xb3x$\x89h\x0fY\xfc\xfc:\x95d\xe4\xffK4A\x9d\xecV\xc0\xef\x81\x0e\x11M\xaa\xb8\x0e\xaek\x14\x03\x…
[::1]:65101:       >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04I\x1e\xfa~\xd6\xf6\xeb\xe7\x1b\xdc\xa6_\xba\x97D\xa7\xf8v(\x92\x12\xdc\xdf\xe8|\x87\x91\xac\\(iJ,\xb3x$\x89h\x0fY\xfc\xfc:\x95d\xe4\xffK4A\x9d\xecV\xc0\xef\x81\x0e\x11M\xaa\xb8\x0e\xaek\x14\x03\x…
[::1]:65101:         >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04I\x1e\xfa~\xd6\xf6\xeb\xe7\x1b\xdc\xa6_\xba\x97D\xa7\xf8v(\x92\x12\xdc\xdf\xe8|\x87\x91\xac\\(iJ,\xb3x$\x89h\x0fY\xfc\xfc:\x95d\xe4\xffK4A\x9d\xecV\xc0\xef\x81\x0e\x11M\xaa\xb8\x0e\xaek\x14\x03\x…
[::1]:65101:         [tls] tls established: Client([::1]:65101, state=open, tls)
[::1]:65101:         << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(>\x95\x10=\xc5\xfb\xca|s2t\x0fvZ\xaf\xc7\xa5\ny\xfd\xf5\x93\x95\x02\x10O\x0bo\xfe\xc4\x01\xd9\x82\xb7A2;\x90\x13\xac')
[::1]:65101:       << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(>\x95\x10=\xc5\xfb\xca|s2t\x0fvZ\xaf\xc7\xa5\ny\xfd\xf5\x93\x95\x02\x10O\x0bo\xfe\xc4\x01\xd9\x82\xb7A2;\x90\x13\xac')
[::1]:65101:     << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(>\x95\x10=\xc5\xfb\xca|s2t\x0fvZ\xaf\xc7\xa5\ny\xfd\xf5\x93\x95\x02\x10O\x0bo\xfe\xc4\x01\xd9\x82\xb7A2;\x90\x13\xac')
[::1]:65101:   << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(>\x95\x10=\xc5\xfb\xca|s2t\x0fvZ\xaf\xc7\xa5\ny\xfd\xf5\x93\x95\x02\x10O\x0bo\xfe\xc4\x01\xd9\x82\xb7A2;\x90\x13\xac')
[::1]:65101:           >> Start({})
[::1]:65101:   >> DataReceived(server, b"\x17\x03\x03\x02\x15\x1f\x0f\xb7\xef\x12\xe1\x122~\xf0\x98\xe3\x1c2\x99\x88\x84\x96\xe2]n\x9c\xf6P\x12C\x825\x83\x1c>_\xa6\xa9\x90\x8f\x92\xc8Q\x1e#\xef\xe5.\xfa\xf6L\x7f\xc7Q\x83d\xe2\x01\xab)\xa1\xbd\xd8\xb2\xe7\xfa\xdcM\xfe\xde'\xb9\xe5\x07\n\xdcR_\xbb\xc2\x81\x84k/\xe3\xd0N\xcc\x98\x03\xc7\xa4g\xa6\xe8_A$\xd8\xbf[\x95\xe1s\xea\xc6\xbb\xbe\xdb\x7f\x8d\x04[\xe8\xe30\x8a\xc6\x84\x1c\x0b\x88\x95\xcc\x13u$s\x1a\x01\xeb\xcf\xf9\r/\xdf\x19\xa8a\x17w\xc5\xdf\xe7!\\c\x1c\xc9\x9a\xb2\x0e…
[::1]:65101:     >> DataReceived(server, b"\x17\x03\x03\x02\x15\x1f\x0f\xb7\xef\x12\xe1\x122~\xf0\x98\xe3\x1c2\x99\x88\x84\x96\xe2]n\x9c\xf6P\x12C\x825\x83\x1c>_\xa6\xa9\x90\x8f\x92\xc8Q\x1e#\xef\xe5.\xfa\xf6L\x7f\xc7Q\x83d\xe2\x01\xab)\xa1\xbd\xd8\xb2\xe7\xfa\xdcM\xfe\xde…
[::1]:65101:       >> DataReceived(server, b'+OK Gpop ready for requests from 24.137.254.57 p23mb49974932uao\r\n')
[::1]:65101: mitmproxy has crashed!
Traceback (most recent call last):
  File "mitmproxy/proxy/server.py", line 279, in server_event
  File "mitmproxy/proxy/layer.py", line 168, in handle_event
  File "mitmproxy/proxy/layer.py", line 168, in handle_event
  File "mitmproxy/proxy/tunnel.py", line 72, in _handle_event
  File "mitmproxy/proxy/layers/tls.py", line 240, in receive_data
  File "mitmproxy/proxy/layers/tls.py", line 306, in event_to_child
  File "mitmproxy/proxy/tunnel.py", line 104, in event_to_child
  File "mitmproxy/proxy/layer.py", line 144, in handle_event
  File "mitmproxy/proxy/tunnel.py", line 72, in _handle_event
  File "mitmproxy/proxy/layers/tls.py", line 225, in receive_data
AttributeError: 'NoneType' object has no attribute 'bio_write'
```
Thanks, this is super helpful! I'll take a look later today.
also crashing on SMTP. from the mail client:

```console
INITIATING CONNECTION Jun 17 12:49:46.234 host:localhost -- port:8282 -- socket:0x0 -- thread:0x600003691340

CONNECTED Jun 17 12:49:46.479 [kCFStreamSocketSecurityLevelTLSv1_2] -- host:localhost -- port:8282 -- socket:0x600000ac0180 -- thread:0x600003691340
```

mitmdump:

```console
% ./mitmdump --mode reverse:https://smtp.gmail.com:465 --set connection_strategy=eager -p8282 -vvv --set proxy_debug=true
Proxy server listening at http://*:8282
[::1]:50064: client connect
[::1]:50064:   >> Start({})
[::1]:50064:   << NextLayerHook(data=NextLayer:None)
[::1]:50064:   >> Reply(NextLayerHook(data=NextLayer:ReverseProxy()),None)
[::1]:50064:   [nextlayer] ReverseProxy()
[::1]:50064:   >> Start({})
[::1]:50064:   << OpenConnection({'connection': Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'smtp.gmail.com', 'tls': True})})
[::1]:50064:   << OpenConnection({'connection': Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'smtp.gmail.com', 'tls': True})})
[::1]:50064: server connect smtp.gmail.com (172.217.204.109:465)
[::1]:50064:   >> Reply(OpenConnection({'connection': Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50065)})}),None)
[::1]:50064:     >> Start({})
[::1]:50064:     << TlsStartHook(data=TlsStartData(conn=Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50065)}), context=<mitmproxy.proxy.context.Context object at 0x10f8cb850>, ssl_conn=None))
[::1]:50064:   << TlsStartHook(data=TlsStartData(conn=Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, '…
[::1]:50064:   >> Reply(TlsStartHook(data=TlsStartData(conn=Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50065), 'alpn_offers': []}), context=<mitmproxy.proxy.context.Context object at 0x10f8cb850>, ssl_conn=<OpenSSL.SSL.Connection object at 0x10f8f4490>)),None)
[::1]:50064:     >> Reply(TlsStartHook(data=TlsStartData(conn=Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521…
[::1]:50064:     << SendData(server, b"\x16\x03\x01\x01/\x01\x00\x01+\x03\x03\x19\xe5\xff\x80d*\x14\x06\x1e\xf1\r\xe3\xb7\xf6\x7f\xe5G\xceH\x82bre\xc9\xf1B\x82#\xa5\x00\xfb\x89 G\x88\xbe\xb3\x06\x9c\x9d\x1f\xd6xO\x8eC+\x08|b\xbb\xbaa\t\xee\xa1\xea\xf1\xc5P\xaf\xe4\xda\xd4\xdd\x00:\x13\x02\x13\x03\x13\x01\xc0+\xc0/\xc0,\xc00\xcc\xa9\xcc\xa8\x00\x9e\x00\x9f\xcc\xaa\xc0#\xc0'\xc0\t\xc0\x13\xc0$\xc0(\xc0\n\xc0\x14\x00g\x00k\x00\x9c\x00\x9d\x00<\x00=\x00/\x005\x00\xff\x01\x00\x00\xa8\x00\x00\x00\x13\x00\x11\x00\x00\x0esmtp.gmail…
[::1]:50064:   << SendData(server, b"\x16\x03\x01\x01/\x01\x00\x01+\x03\x03\x19\xe5\xff\x80d*\x14\x06\x1e\xf1\r\xe3\xb7\xf6\x7f\xe5G\xceH\x82bre\xc9\xf1B\x82#\xa5\x00\xfb\x89 G\x88\xbe\xb3\x06\x9c\x9d\x1f\xd6xO\x8eC+\x08|b\xbb\xbaa\t\xee\xa1\xea\xf1\xc5P\xaf\xe4\xda\xd4\…
[::1]:50064:   >> DataReceived(server, b'\x16\x03\x03\x00z\x02\x00\x00v\x03\x03\xa6\xc4\x8b,\n\x16\xc0\xba\xa7\xd3v\xc1\x89k\xe7\xc6\xfb\xb5\xcb\x9b3\xabac\x95\x00\xde\xa1\x1bm\xa5\x94 G\x88\xbe\xb3\x06\x9c\x9d\x1f\xd6xO\x8eC+\x08|b\xbb\xbaa\t\xee\xa1\xea\xf1\xc5P\xaf\xe4\xda\xd4\xdd\x13\x02\x00\x00.\x003\x00$\x00\x1d\x00 \x94Ry\x13\xeb\xe4\xf3\r\x81\xb6\x90\xff\xe8\x12X\x16\x12\xab)\x93|}\xb5\xf0U\x1f\xa20I\xd3\xbd\x19\x00+\x00\x02\x03\x04\x14\x03\x03\x00\x01\x01\x17\x03\x03\t\xc7\xda\xb3\x8f\xe4N#\x10m\xb2\xaf\xb3\xecN\…
[::1]:50064:     >> DataReceived(server, b'\x16\x03\x03\x00z\x02\x00\x00v\x03\x03\xa6\xc4\x8b,\n\x16\xc0\xba\xa7\xd3v\xc1\x89k\xe7\xc6\xfb\xb5\xcb\x9b3\xabac\x95\x00\xde\xa1\x1bm\xa5\x94 G\x88\xbe\xb3\x06\x9c\x9d\x1f\xd6xO\x8eC+\x08|b\xbb\xbaa\t\xee\xa1\xea\xf1\xc5P\xaf\xe…
[::1]:50064:     [tls] tls established: Server(smtp.gmail.com:465, state=open, tls, src_port=50065)
[::1]:50064:     << SendData(server, b'\x14\x03\x03\x00\x01\x01\x17\x03\x03\x00E\x15\xc2j\xf0\x90Q\x1d\xed\x83\x98\x84\xae\x16\xbc\x7f\xee\xedk\xf7\x8d)2^}\rM\x95\xda\x19\xc2\nX\xd0a\x04\xcc\xbbK\xff\xda\xbct\x1a&}:m\xedc\x0b\n\xda*\x88\x19\xe6\xa8\xf9\x82\xf3\xe4\xd7\xd3\xf3Q"\xd5\x1e\xba')
[::1]:50064:   << SendData(server, b'\x14\x03\x03\x00\x01\x01\x17\x03\x03\x00E\x15\xc2j\xf0\x90Q\x1d\xed\x83\x98\x84\xae\x16\xbc\x7f\xee\xedk\xf7\x8d)2^}\rM\x95\xda\x19\xc2\nX\xd0a\x04\xcc\xbbK\xff\xda\xbct\x1a&}:m\xedc\x0b\n\xda*\x88\x19\xe6\xa8\xf9\x82\xf3\xe4\xd7\xd3\…
[::1]:50064:       >> Start({})
[::1]:50064:   >> DataReceived(server, b'\x17\x03\x03\x02\x15cc]\x846\xa1\x15\xd4lZC"hr\xd6\xfb"\xa6\x14S\xa752V}F@\x8d\x8eg\xde\xaf\x15M\xf4r\x86F\x0em\rE[}w\x94^?f/\x88\x89\xce,\xbf!\n\xd8\x87\r\xe0\x01\xa4T][B\xa0\x7fu\x7f\xbb-\x1e\xfaU\x1f\xa7\x99\xa8o$\x899\x15k\x9a\xf1_Q\xb3\x17\x00\xcbr\xd7\x8f\xeb\xedb.<\xc5\x1c\xd4\x81\xd2G\xf8.\x00U$\xf4\xf0\xaa\x8b\xdf~Nd\x04\xdaL\xd5\xb3-\xcetJ\xa35B\x10^\xe0\x12!\xff$vy\xeb\xab8\t\x04d\x92B\xb2\xbe,\xc7*\x86\xe9+N*\x85_\xde\x91Z\n\xf8}\x95Wl\xcc\x91\xc2\xc9\xa3J59\xe7}e\xae\x…
[::1]:50064:     >> DataReceived(server, b'\x17\x03\x03\x02\x15cc]\x846\xa1\x15\xd4lZC"hr\xd6\xfb"\xa6\x14S\xa752V}F@\x8d\x8eg\xde\xaf\x15M\xf4r\x86F\x0em\rE[}w\x94^?f/\x88\x89\xce,\xbf!\n\xd8\x87\r\xe0\x01\xa4T][B\xa0\x7fu\x7f\xbb-\x1e\xfaU\x1f\xa7\x99\xa8o$\x899\x15k\x9a…
[::1]:50064:       >> DataReceived(server, b'220 smtp.gmail.com ESMTP k15sm878177uaq.19 - gsmtp\r\n')
[::1]:50064:       << NextLayerHook(data=NextLayer:None)
[::1]:50064:     << NextLayerHook(data=NextLayer:None)
[::1]:50064:   << NextLayerHook(data=NextLayer:None)
[::1]:50064:   >> Reply(NextLayerHook(data=NextLayer:TCPLayer(state: start)),None)
[::1]:50064:     >> Reply(NextLayerHook(data=NextLayer:TCPLayer(state: start)),None)
[::1]:50064:       >> Reply(NextLayerHook(data=NextLayer:TCPLayer(state: start)),None)
[::1]:50064:       [nextlayer] TCPLayer(state: start)
[::1]:50064:       >> Start({})
[::1]:50064:       << TcpStartHook(flow=<TCPFlow (0 messages)>)
[::1]:50064:       << TcpStartHook(flow=<TCPFlow (0 messages)>)
[::1]:50064:     << TcpStartHook(flow=<TCPFlow (0 messages)>)
[::1]:50064:   << TcpStartHook(flow=<TCPFlow (0 messages)>)
[::1]:50064:       >! DataReceived(server, b'220 smtp.gmail.com ESMTP k15sm878177uaq.19 - gsmtp\r\n')
[::1]:50064:   >> Reply(TcpStartHook(flow=<TCPFlow (0 messages)>),None)
[::1]:50064:     >> Reply(TcpStartHook(flow=<TCPFlow (0 messages)>),None)
[::1]:50064:       >> Reply(TcpStartHook(flow=<TCPFlow (0 messages)>),None)
[::1]:50064:       !> DataReceived(server, b'220 smtp.gmail.com ESMTP k15sm878177uaq.19 - gsmtp\r\n')
[::1]:50064:       << TcpMessageHook(flow=<TCPFlow (1 messages)>)
[::1]:50064:     << TcpMessageHook(flow=<TCPFlow (1 messages)>)
[::1]:50064:   << TcpMessageHook(flow=<TCPFlow (1 messages)>)
[::1]:50064 <- tcp <- smtp.gmail.com:465
[::1]:50064:   >> Reply(TcpMessageHook(flow=<TCPFlow (1 messages)>),None)
[::1]:50064:     >> Reply(TcpMessageHook(flow=<TCPFlow (1 messages)>),None)
[::1]:50064:       >> Reply(TcpMessageHook(flow=<TCPFlow (1 messages)>),None)
[::1]:50064:       << SendData(client, b'220 smtp.gmail.com ESMTP k15sm878177uaq.19 - gsmtp\r\n')
[::1]:50064:     << SendData(client, b'220 smtp.gmail.com ESMTP k15sm878177uaq.19 - gsmtp\r\n')
[::1]:50064:   << SendData(client, b'220 smtp.gmail.com ESMTP k15sm878177uaq.19 - gsmtp\r\n')
[::1]:50064:   >> ConnectionClosed(connection=Client({'id': '…529a3f', 'peername': ('::1', 50064, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948574.192099, 'state': <ConnectionState.CAN_WRITE: 2>, 'reply': None}))
[::1]:50064:     >> ConnectionClosed(connection=Client({'id': '…529a3f', 'peername': ('::1', 50064, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948574.192099, 'state': <ConnectionState.CAN_WRITE: 2>, 'reply': None}))
[::1]:50064:       >> ConnectionClosed(connection=Client({'id': '…529a3f', 'peername': ('::1', 50064, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948574.192099, 'state': <ConnectionState.CAN_WRITE: 2>, 'reply': None}))
[::1]:50064:       << CloseConnection({'connection': Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50065), 'alpn_offers': [], 'timestamp_tls_setup': 1623948574.6460001, 'alpn': b'', 'certificate_list': [<mitmproxy.certs.Cert object at 0x10f8f45b0>, <mitmproxy.certs.Cert object at 0x10f8f4640…
[::1]:50064:     << CloseConnection({'connection': Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peern…
[::1]:50064:   << CloseConnection({'connection': Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peern…
[::1]:50064: half-closing Server(smtp.gmail.com:465, state=open, tls, src_port=50065)
[::1]:50064:   >> ConnectionClosed(connection=Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50065), 'alpn_offers': [], 'timestamp_tls_setup': 1623948574.6460001, 'alpn': b'', 'certificate_list': [<mitmproxy.certs.Cert object at 0x10f8f45b0>, <mitmproxy.certs.Cert object at 0x10f8f4640>…
[::1]:50064:     >> ConnectionClosed(connection=Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peerna…
[::1]:50064:       >> ConnectionClosed(connection=Server({'id': '…17df85', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948574.1959229, 'timestamp_tcp_setup': 1623948574.521889, 'peerna…
[::1]:50064:       << CloseConnection({'connection': Client({'id': '…529a3f', 'peername': ('::1', 50064, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948574.192099, 'state': <ConnectionState.CAN_WRITE: 2>, 'reply': None}), 'half_close': False})
[::1]:50064:     << CloseConnection({'connection': Client({'id': '…529a3f', 'peername': ('::1', 50064, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948574.192099, 'state': <ConnectionState.CAN_WRITE: 2>, 'reply': None}), 'half_close': False})
[::1]:50064:   << CloseConnection({'connection': Client({'id': '…529a3f', 'peername': ('::1', 50064, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948574.192099, 'state': <ConnectionState.CAN_WRITE: 2>, 'reply': None}), 'half_close': False})
[::1]:50064:       << TcpEndHook(flow=<TCPFlow (1 messages)>)
[::1]:50064:     << TcpEndHook(flow=<TCPFlow (1 messages)>)
[::1]:50064:   << TcpEndHook(flow=<TCPFlow (1 messages)>)
[::1]:50064: server disconnect smtp.gmail.com (172.217.204.109:465)
[::1]:50064: client disconnect
[::1]:50064:   >> Reply(TcpEndHook(flow=<TCPFlow (1 messages)>),None)
[::1]:50064:     >> Reply(TcpEndHook(flow=<TCPFlow (1 messages)>),None)
[::1]:50064:       >> Reply(TcpEndHook(flow=<TCPFlow (1 messages)>),None)
[::1]:50064: closing transports...
[::1]:50064: transports closed!
[::1]:50104: client connect
[::1]:50104:   >> Start({})
[::1]:50104:   << NextLayerHook(data=NextLayer:None)
[::1]:50104:   >! DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104:   >> Reply(NextLayerHook(data=NextLayer:ReverseProxy()),None)
[::1]:50104:   [nextlayer] ReverseProxy()
[::1]:50104:   >> Start({})
[::1]:50104:   << OpenConnection({'connection': Server({'id': '…ef1b92', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'smtp.gmail.com', 'tls': True})})
[::1]:50104:   << OpenConnection({'connection': Server({'id': '…ef1b92', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.CLOSED: 0>, 'sni': 'smtp.gmail.com', 'tls': True})})
[::1]:50104:   !> DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104:   >! DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104: server connect smtp.gmail.com (172.217.204.109:465)
[::1]:50104:   >> Reply(OpenConnection({'connection': Server({'id': '…ef1b92', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948586.253964, 'timestamp_tcp_setup': 1623948586.336297, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50105)})}),None)
[::1]:50104:     >> Start({})
[::1]:50104:     << TlsStartHook(data=TlsStartData(conn=Server({'id': '…ef1b92', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948586.253964, 'timestamp_tcp_setup': 1623948586.336297, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50105)}), context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, ssl_conn=None))
[::1]:50104:   << TlsStartHook(data=TlsStartData(conn=Server({'id': '…ef1b92', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948586.253964, 'timestamp_tcp_setup': 1623948586.336297, 'p…
[::1]:50104:   !> DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104:     >! DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104:   >> Reply(TlsStartHook(data=TlsStartData(conn=Server({'id': '…ef1b92', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948586.253964, 'timestamp_tcp_setup': 1623948586.336297, 'peername': ('172.217.204.109', 465), 'sockname': ('192.168.86.222', 50105), 'alpn_offers': []}), context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, ssl_conn=<OpenSSL.SSL.Connection object at 0x10f9173d0>)),None)
[::1]:50104:     >> Reply(TlsStartHook(data=TlsStartData(conn=Server({'id': '…ef1b92', 'address': ('smtp.gmail.com', 465), 'state': <ConnectionState.OPEN: 3>, 'sni': 'smtp.gmail.com', 'tls': True, 'timestamp_start': 1623948586.253964, 'timestamp_tcp_setup': 1623948586.3362…
[::1]:50104:     << SendData(server, b'\x16\x03\x01\x01/\x01\x00\x01+\x03\x03\xcf\xd6\xdc\xb2\xd2\x17\xc1R\xdf\x1c\xb7\x1c\xa3\xd7f\xef\xb7R\x02a-\xfb\xb6c\xa2\xecn\x81\xba\xf9\x88\xc6 -~\x16\xd6\xd2\xc9\x10\x88`\xeeq\x1dG\x8c\xb6\xed"\x9a\x9b\xb6\x15\x12\xdb\xd7i\x89k(J\xa1#q\x00:\x13\x02\x13\x03\x13\x01\xc0+\xc0/\xc0,\xc00\xcc\xa9\xcc\xa8\x00\x9e\x00\x9f\xcc\xaa\xc0#\xc0\'\xc0\t\xc0\x13\xc0$\xc0(\xc0\n\xc0\x14\x00g\x00k\x00\x9c\x00\x9d\x00<\x00=\x00/\x005\x00\xff\x01\x00\x00\xa8\x00\x00\x00\x13\x00\x11\x00\x00\x0esmtp.gma…
[::1]:50104:   << SendData(server, b'\x16\x03\x01\x01/\x01\x00\x01+\x03\x03\xcf\xd6\xdc\xb2\xd2\x17\xc1R\xdf\x1c\xb7\x1c\xa3\xd7f\xef\xb7R\x02a-\xfb\xb6c\xa2\xecn\x81\xba\xf9\x88\xc6 -~\x16\xd6\xd2\xc9\x10\x88`\xeeq\x1dG\x8c\xb6\xed"\x9a\x9b\xb6\x15\x12\xdb\xd7i\x89k(J\x…
[::1]:50104:     !> DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104:   >> DataReceived(server, b'\x16\x03\x03\x00z\x02\x00\x00v\x03\x03\\\x93\x98\x8eM\x06\x98\x90I\xe8Z`\xb1\xf0V\x10\xd9"\x9aME\n\xfe\xa0\xb6\xb6\xa9\xc6\xe8\xce\xa0e -~\x16\xd6\xd2\xc9\x10\x88`\xeeq\x1dG\x8c\xb6\xed"\x9a\x9b\xb6\x15\x12\xdb\xd7i\x89k(J\xa1#q\x13\x02\x00\x00.\x003\x00$\x00\x1d\x00 K\x03\xcd6\x88g\xf7\x90\xd8\xc4\x9f\x11\xf8\xd9[_egOb\x881)\x80\\\xc6}0L\x83\x01\x15\x00+\x00\x02\x03\x04\x14\x03\x03\x00\x01\x01\x17\x03\x03\t\xc5\xb2\x92\x97\x83\xf6bS\xd3\x95C\x17\xe5\x1d%\xd2\xc2W\x16\xa6\x05\xdd\x…
[::1]:50104:     >> DataReceived(server, b'\x16\x03\x03\x00z\x02\x00\x00v\x03\x03\\\x93\x98\x8eM\x06\x98\x90I\xe8Z`\xb1\xf0V\x10\xd9"\x9aME\n\xfe\xa0\xb6\xb6\xa9\xc6\xe8\xce\xa0e -~\x16\xd6\xd2\xc9\x10\x88`\xeeq\x1dG\x8c\xb6\xed"\x9a\x9b\xb6\x15\x12\xdb\xd7i\x89k(J\xa1#q\x…
[::1]:50104:     [tls] tls established: Server(smtp.gmail.com:465, state=open, tls, src_port=50105)
[::1]:50104:     << SendData(server, b'\x14\x03\x03\x00\x01\x01\x17\x03\x03\x00E\xa8\xfa\xaeH\xa8J\x85\xb6w4S\xc1\xa3\xebT"\x00*i\xab\x04a\xc4\x04,\xcc\xfb\xbb\xc5d\xe1\xc3\x81{\\\xd0<\x16s\xf7\xb2!\xb93\n=\x85!\xb1\x9d\xc0\xb6\xfb\xf3\xcd7\xa9\xb8\xde^{.\xd2\xf0\xaa\xeb\x15\x98\xe2')
[::1]:50104:   << SendData(server, b'\x14\x03\x03\x00\x01\x01\x17\x03\x03\x00E\xa8\xfa\xaeH\xa8J\x85\xb6w4S\xc1\xa3\xebT"\x00*i\xab\x04a\xc4\x04,\xcc\xfb\xbb\xc5d\xe1\xc3\x81{\\\xd0<\x16s\xf7\xb2!\xb93\n=\x85!\xb1\x9d\xc0\xb6\xfb\xf3\xcd7\xa9\xb8\xde^{.\xd2\xf0\xaa\xeb\x…
[::1]:50104:       >> Start({})
[::1]:50104:       >> DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104:       << NextLayerHook(data=NextLayer:None)
[::1]:50104:     << NextLayerHook(data=NextLayer:None)
[::1]:50104:   << NextLayerHook(data=NextLayer:None)
[::1]:50104:   >> Reply(NextLayerHook(data=NextLayer:ServerTLSLayer(inactive smtp.gmail.com b'')),None)
[::1]:50104:     >> Reply(NextLayerHook(data=NextLayer:ServerTLSLayer(inactive smtp.gmail.com b'')),None)
[::1]:50104:       >> Reply(NextLayerHook(data=NextLayer:ServerTLSLayer(inactive smtp.gmail.com b'')),None)
[::1]:50104:       [nextlayer] ServerTLSLayer(inactive smtp.gmail.com b'')
[::1]:50104:       >> Start({})
[::1]:50104:         >> Start({})
[::1]:50104:       >> DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1U\x00:\x00\xff\xc0,\xc0+\xc0$\xc0#\xc0\n\xc0\t\xc0\x08\xc00\xc0/\xc0(\xc0'\xc0\x14\xc0\x13\xc0\x12\x00\x9f\x00\x9e\x00k\x00g\x009\x003\x00\x16\x00\x9d\x00\x9c\x00=\x00<\x005\x00/\x00\n\x01\x00\x00K\x00\x00\x00\x0e\x00\x0c\x00\x00\tlocalhost\x00\n\x00\x08\x…
[::1]:50104:         >> DataReceived(client, b"\x16\x03\x01\x00\xd2\x01\x00\x00\xce\x03\x03`\xcb}*\x90d\xdd\xd1\x01\xdbT6\x80\x1a\xe3y\x9c\xa5a\xdd\x18\xa6}\xc5<\x9a\xa6\x93\xb8\xf9\x1f  \xbb0\x1f]\xc3,1=\x8bb\x8e9\xf3\\\x18\xfb\xe8\x83\xc1\t\xed\xa0\xad\x85\xbc*\x18.\x08;\xd1…
[::1]:50104:         << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=False))
[::1]:50104:       << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=False))
[::1]:50104:       << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=False))
[::1]:50104:     << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=False))
[::1]:50104:   << TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=False))
[::1]:50104:   >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=True)),None)
[::1]:50104:     >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=True)),None)
[::1]:50104:       >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=True)),None)
[::1]:50104:         >> Reply(TlsClienthelloHook(data=ClientHelloData(context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, establish_server_tls_first=True)),None)
[::1]:50104:         << TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'alpn_offers': []}), context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, ssl_conn=None))
[::1]:50104:       << TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'a…
[::1]:50104:     << TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'a…
[::1]:50104:   << TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'a…
[::1]:50104:   >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhost', 'alpn_offers': []}), context=<mitmproxy.proxy.context.Context object at 0x10f8ea970>, ssl_conn=<OpenSSL.SSL.Connection object at 0x10f928e80>)),None)
[::1]:50104:     >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhos…
[::1]:50104:       >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhos…
[::1]:50104:         >> Reply(TlsStartHook(data=TlsStartData(conn=Client({'id': '…1b9fc8', 'peername': ('::1', 50104, 0, 0), 'sockname': ('::1', 8282, 0, 0), 'timestamp_start': 1623948586.2467752, 'state': <ConnectionState.OPEN: 3>, 'reply': None, 'tls': True, 'sni': 'localhos…
[::1]:50104:         << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03*\x8e\xcd\xd4\xb3+E\xd49v\x05s\xb2\xcd\xa3\xfa\xc4\xce!\xea_\x8b"IDOWNGRD\x01 \xdd\x03\xbcu`\xa0\x1f\xaf\xb1\xdc\x15g\xeb\x15\xa3\xf8\x9e\xb2q\x9e\xccA\xd9\xb0\x1e3\t\x87\xa8\xd4\x93?\xc0/\x00\x00\x11\xff\x01\x00\x01\x00\x00\x0b\x00\x04\x03\x00\x01\x02\x00\x17\x00\x00\x16\x03\x03\x03/\x0b\x00\x03+\x00\x03(\x00\x03%0\x82\x03!0\x82\x02\t\xa0\x03\x02\x01\x02\x02\x14\x1b\xbcbs\x95tRF_\x88d\xee\xb4fZ\xaf\x8e}\xfa/0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x0…
[::1]:50104:       << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03*\x8e\xcd\xd4\xb3+E\xd49v\x05s\xb2\xcd\xa3\xfa\xc4\xce!\xea_\x8b"IDOWNGRD\x01 \xdd\x03\xbcu`\xa0\x1f\xaf\xb1\xdc\x15g\xeb\x15\xa3\xf8\x9e\xb2q\x9e\xccA\xd9\xb0\x1e3\t\x87\xa8\xd4\x93?\xc0/\x00\x00…
[::1]:50104:     << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03*\x8e\xcd\xd4\xb3+E\xd49v\x05s\xb2\xcd\xa3\xfa\xc4\xce!\xea_\x8b"IDOWNGRD\x01 \xdd\x03\xbcu`\xa0\x1f\xaf\xb1\xdc\x15g\xeb\x15\xa3\xf8\x9e\xb2q\x9e\xccA\xd9\xb0\x1e3\t\x87\xa8\xd4\x93?\xc0/\x00\x00…
[::1]:50104:   << SendData(client, b'\x16\x03\x03\x00]\x02\x00\x00Y\x03\x03*\x8e\xcd\xd4\xb3+E\xd49v\x05s\xb2\xcd\xa3\xfa\xc4\xce!\xea_\x8b"IDOWNGRD\x01 \xdd\x03\xbcu`\xa0\x1f\xaf\xb1\xdc\x15g\xeb\x15\xa3\xf8\x9e\xb2q\x9e\xccA\xd9\xb0\x1e3\t\x87\xa8\xd4\x93?\xc0/\x00\x00…
[::1]:50104:   >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04\xf5\xfd\xd2\xb8\xe4\x07cYT\x1f\xe6\xd2>\xd3\xa2\xa0Z\x82\xee\xadi)|\x0f?\xd2\xe6\xf0#\x8erY@r1\x9a\xe1T\xbc\xe6K\xb1\x0f\xf0\xa3\x1f\xcc\xa3"\xcd\x869{\xc6ap\xb9\x89j&\xc9~\xde\'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(L\x11|E\xa4\xc2\x84\xb0\xd4c\xa7"F\x11*\\\x11~\xa8o\xf0"\x9e\x80^-e\x86\xf8\x10\xa2\xe2_\xf8\x0f%\xd2\x08&\xcf')
[::1]:50104:     >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04\xf5\xfd\xd2\xb8\xe4\x07cYT\x1f\xe6\xd2>\xd3\xa2\xa0Z\x82\xee\xadi)|\x0f?\xd2\xe6\xf0#\x8erY@r1\x9a\xe1T\xbc\xe6K\xb1\x0f\xf0\xa3\x1f\xcc\xa3"\xcd\x869{\xc6ap\xb9\x89j&\xc9~\xde\'\x14\x03\x03\x00…
[::1]:50104:       >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04\xf5\xfd\xd2\xb8\xe4\x07cYT\x1f\xe6\xd2>\xd3\xa2\xa0Z\x82\xee\xadi)|\x0f?\xd2\xe6\xf0#\x8erY@r1\x9a\xe1T\xbc\xe6K\xb1\x0f\xf0\xa3\x1f\xcc\xa3"\xcd\x869{\xc6ap\xb9\x89j&\xc9~\xde\'\x14\x03\x03\x00…
[::1]:50104:         >> DataReceived(client, b'\x16\x03\x03\x00F\x10\x00\x00BA\x04\xf5\xfd\xd2\xb8\xe4\x07cYT\x1f\xe6\xd2>\xd3\xa2\xa0Z\x82\xee\xadi)|\x0f?\xd2\xe6\xf0#\x8erY@r1\x9a\xe1T\xbc\xe6K\xb1\x0f\xf0\xa3\x1f\xcc\xa3"\xcd\x869{\xc6ap\xb9\x89j&\xc9~\xde\'\x14\x03\x03\x00…
[::1]:50104:         [tls] tls established: Client([::1]:50104, state=open, tls)
[::1]:50104:         << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(\xd0k\x1dCX\x84C\x12t\xd8\xd6K\xda\xa0\x02s\xb6h\t?J\xe8\x15\xeb\xda\xf0\xe1\xeaZ\n\xa3M#@=\x16\xa7:\xbc\xec')
[::1]:50104:       << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(\xd0k\x1dCX\x84C\x12t\xd8\xd6K\xda\xa0\x02s\xb6h\t?J\xe8\x15\xeb\xda\xf0\xe1\xeaZ\n\xa3M#@=\x16\xa7:\xbc\xec')
[::1]:50104:     << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(\xd0k\x1dCX\x84C\x12t\xd8\xd6K\xda\xa0\x02s\xb6h\t?J\xe8\x15\xeb\xda\xf0\xe1\xeaZ\n\xa3M#@=\x16\xa7:\xbc\xec')
[::1]:50104:   << SendData(client, b'\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(\xd0k\x1dCX\x84C\x12t\xd8\xd6K\xda\xa0\x02s\xb6h\t?J\xe8\x15\xeb\xda\xf0\xe1\xeaZ\n\xa3M#@=\x16\xa7:\xbc\xec')
[::1]:50104:           >> Start({})
[::1]:50104:   >> DataReceived(server, b'\x17\x03\x03\x02\x15\xb5\xb7\xb2\xd5\x0e\x8f\xd3\x0f\x87\xd2\\.\xbe\x03V\xb1\x9d_\x08\x8de$\xee\xb7\\L*\'Q\xe9\r\xb2\x04\x05\x04\xc05\xa1V;\x859\xdbq\xa2\xbd\xe8%\xef\x1a\xe7ii\x94kp\xfb\xed\xee\x93\xa8_\x9eR\x1d\n\xd1D\xe4\x91\xc8\xf4\x16\xf8\xf9\xfb[:\x82r"[\xa4\x89\x10[w6\x99\xe5\xa5\xe9\x0c\xf6\xc9n\x17\xc3\xd7v\x06\xd4\xc9\x06\xb7R>%\x81\x03\x9f5qI\t\x8b\xa14\x9e\x8e+\xdb\x1d\x9f<\xa0\x19+%\xd5;\xc2\xd3\xa0\x8c7\xa5\xfcWY0\xc9A\xeap\xa7kd\'-\xb3H\x9d\xbc\xe4$!C\xc4B\xadG\x89g\…
[::1]:50104:     >> DataReceived(server, b'\x17\x03\x03\x02\x15\xb5\xb7\xb2\xd5\x0e\x8f\xd3\x0f\x87\xd2\\.\xbe\x03V\xb1\x9d_\x08\x8de$\xee\xb7\\L*\'Q\xe9\r\xb2\x04\x05\x04\xc05\xa1V;\x859\xdbq\xa2\xbd\xe8%\xef\x1a\xe7ii\x94kp\xfb\xed\xee\x93\xa8_\x9eR\x1d\n\xd1D\xe4\x91\xc…
[::1]:50104:       >> DataReceived(server, b'220 smtp.gmail.com ESMTP e19sm712405uaa.16 - gsmtp\r\n')
[::1]:50104: mitmproxy has crashed!
Traceback (most recent call last):
  File "mitmproxy/proxy/server.py", line 279, in server_event
  File "mitmproxy/proxy/layer.py", line 168, in handle_event
  File "mitmproxy/proxy/layer.py", line 168, in handle_event
  File "mitmproxy/proxy/tunnel.py", line 72, in _handle_event
  File "mitmproxy/proxy/layers/tls.py", line 240, in receive_data
  File "mitmproxy/proxy/layers/tls.py", line 306, in event_to_child
  File "mitmproxy/proxy/tunnel.py", line 104, in event_to_child
  File "mitmproxy/proxy/layer.py", line 144, in handle_event
  File "mitmproxy/proxy/tunnel.py", line 72, in _handle_event
  File "mitmproxy/proxy/layers/tls.py", line 225, in receive_data
AttributeError: 'NoneType' object has no attribute 'bio_write'
```
Fantastic, thanks! I can reproduce it now, which generally makes fixing much easier. :)

Resolving patch:
diff --git a/mitmproxy/addons/next_layer.py b/mitmproxy/addons/next_layer.py
--- a/mitmproxy/addons/next_layer.py
+++ b/mitmproxy/addons/next_layer.py
@@ -115,9 +115,13 @@ def s(*layers):
         # 2. Check for TLS
         if client_tls:
             # client tls usually requires a server tls layer as parent layer, except:
-            #  - reverse proxy mode manages this itself.
             #  - a secure web proxy doesn't have a server part.
-            if s(modes.ReverseProxy) or s(modes.HttpProxy):
+            #  - reverse proxy mode manages this itself.
+            if (
+                s(modes.HttpProxy) or
+                s(modes.ReverseProxy) or
+                s(modes.ReverseProxy, layers.ServerTLSLayer)
+            ):
                 return layers.ClientTLSLayer(context)
             else:
                 # We already assign the next layer here os that ServerTLSLayer
@@ -127,11 +131,11 @@ def s(*layers):
                 return ret
 
         # 3. Setup the HTTP layer for a regular HTTP proxy or an upstream proxy.
-        if any([
-            s(modes.HttpProxy),
+        if (
+            s(modes.HttpProxy) or
             # or a "Secure Web Proxy", see https://www.chromium.org/developers/design-documents/secure-web-proxy
-            s(modes.HttpProxy, layers.ClientTLSLayer),
-        ]):
+            s(modes.HttpProxy, layers.ClientTLSLayer)
+        ):
             if ctx.options.mode == "regular":
                 return layers.HttpLayer(context, HTTPMode.regular)
             else:


Test patch: