Impelment connect method

I implemented connect method which automatically close connection (https://github.com/jubatus/jubatus/issues/389)