public void start() { try { logger.debug("~~ [CONNECT] {0}:{1}.", host, port); channel = SocketChannelFactory.create(host, port, logger); protocol = negotiateProtocol(); reader = protocol.reader(); writer = protocol.writer(); } catch (ConnectException e) { throw new ClientException( String.format( "Unable to connect to '%s' on port %s, " + "ensure the database is running and that there is a working " + "network " + "connection to it.", host, port)); } catch (IOException e) { throw new ClientException("Unable to process request: " + e.getMessage(), e); } }
@Override public String toString() { int version = protocol == null ? -1 : protocol.version(); return "SocketClient[protocolVersion=" + version + "]"; }