def METHOD_NAME(self):
    self.mock_nats_client.is_connected.return_value = True
    self.transport._is_open = True
    data = bytearray('test')
    frame_length = struct.pack('!I', len(data))
    f = concurrent.Future()
    f.set_result("")
    self.mock_nats_client.publish_request.return_value = f
    self.mock_nats_client._flush_pending.return_value = f
    yield self.transport.flush(frame_length + data)
    self.mock_nats_client.publish_request.assert_called_with(
        self.subject,
        self.inbox,
        frame_length + data
    )