Added history handlers to replace the current hardcoded behavior in
connection.

Signed-off-by: Jakob Brandsborg Ehmsen <jakobehmsen.github@gmail.com>