It seems that the forward method caused the error:

static void forward(TCPConnection client,TCPConnection remote)
{
	auto wtask = runTask({
			remote.write(client);
		});
	client.write(remote);
	// wait for the tasks to finish
	wtask.join();
}