/** Read bytes from the input stream. */ private byte[] read(int len) throws ClientConnectionException { byte[] bytes = new byte[len]; int bytesNum; int readBytesNum = 0; while (readBytesNum < len) { try { bytesNum = in.read(bytes, readBytesNum, len - readBytesNum); } catch (IOException e) { throw new ClientConnectionException(e); } if (bytesNum < 0) throw new ClientConnectionException(); readBytesNum += bytesNum; } return bytes; }
failure = e; else failure.addSuppressed(e);
igniteUnavailable = true; Throwable[] suppressed = ex.getSuppressed();
failure = e; else failure.addSuppressed(e);
/** Write bytes to the output stream. */ private void write(byte[] bytes, int len) throws ClientConnectionException { try { out.write(bytes, 0, len); out.flush(); } catch (IOException e) { throw new ClientConnectionException(e); } }
/** Constructor. */ TcpClientChannel(ClientChannelConfiguration cfg) throws ClientConnectionException, ClientAuthenticationException { validateConfiguration(cfg); try { sock = createSocket(cfg); out = sock.getOutputStream(); in = sock.getInputStream(); } catch (IOException e) { throw new ClientConnectionException(e); } handshake(cfg.getUserName(), cfg.getUserPassword()); }
throw new ClientConnectionException(e);
/** Read bytes from the input stream. */ private byte[] read(int len) throws ClientConnectionException { byte[] bytes = new byte[len]; int bytesNum; int readBytesNum = 0; while (readBytesNum < len) { try { bytesNum = in.read(bytes, readBytesNum, len - readBytesNum); } catch (IOException e) { throw new ClientConnectionException(e); } if (bytesNum < 0) throw new ClientConnectionException(); readBytesNum += bytesNum; } return bytes; }
/** Write bytes to the output stream. */ private void write(byte[] bytes, int len) throws ClientConnectionException { try { out.write(bytes, 0, len); out.flush(); } catch (IOException e) { throw new ClientConnectionException(e); } }
/** Constructor. */ TcpClientChannel(ClientChannelConfiguration cfg) throws ClientConnectionException, ClientAuthenticationException { validateConfiguration(cfg); try { sock = createSocket(cfg); out = sock.getOutputStream(); in = sock.getInputStream(); } catch (IOException e) { throw new ClientConnectionException(e); } handshake(cfg.getUserName(), cfg.getUserPassword()); }