Connet will fail if the handshake result is not SUCCESS
Added #[inline] flag to several small methods