Execute a closing handshake. This puts the connection in the CLOSED state.
(self, code=CloseCode.NORMAL_CLOSURE, reason="close")
| 171 | self.receive_eof() |
| 172 | |
| 173 | def close_connection(self, code=CloseCode.NORMAL_CLOSURE, reason="close"): |
| 174 | """ |
| 175 | Execute a closing handshake. |
| 176 | |
| 177 | This puts the connection in the CLOSED state. |
| 178 | |
| 179 | """ |
| 180 | close_frame_data = Close(code, reason).serialize() |
| 181 | # Prepare the response to the closing handshake from the remote side. |
| 182 | self.receive_frame(Frame(True, OP_CLOSE, close_frame_data)) |
| 183 | self.receive_eof_if_client() |
| 184 | # Trigger the closing handshake from the local side and complete it. |
| 185 | self.loop.run_until_complete(self.protocol.close(code, reason)) |
| 186 | # Empty the outgoing data stream so we can make assertions later on. |
| 187 | self.assertOneFrameSent(True, OP_CLOSE, close_frame_data) |
| 188 | |
| 189 | assert self.protocol.state is State.CLOSED |
| 190 | |
| 191 | def half_close_connection_local( |
| 192 | self, |
no test coverage detected