support IPv6 in OFConnectionManager

Reviewer: @kenchiang

This pull request refactors a few places that need to handle different protocol
types, then adds IPv6 support. I tested this manually by connecting to a
controller using loopback and link-local addresses.
This is required by RFC 3986 (URI syntax). It disambiguates whether the port number is present.