@Override public int input(byte[] bytes, int offset, int length) { oldApiCheckStateBeforeInput(length).checkIsOk(); ByteBuffer inputBuffer = getInputBuffer(); int numberOfBytesConsumed = pourArrayToBuffer(bytes, offset, length, inputBuffer); processInput().checkIsOk(); return numberOfBytesConsumed; }
private void readFromNetwork(Connection connection, InputStream in, BooleanSupplier test) throws IOException, LoginException { Transport transport = connection.getTransport(); while(test.getAsBoolean()) { ByteBuffer buf = transport.getInputBuffer(); byte[] tmpBuf = new byte[buf.remaining()]; int bytesRead = in.read(tmpBuf); LOG.tracev("read {0} bytes", bytesRead); if (bytesRead == -1) { throw new LoginException("Unexpected EOS experienced when authenticating using SASL delegation"); } else { buf.put(tmpBuf, 0, bytesRead); TransportResult result = transport.processInput(); if(!result.isOk()) { LoginException e = new LoginException("Unexpected error when authenticating using SASL delegation"); e.initCause(result.getException()); throw e; } } } }
@Override public int input(byte[] bytes, int offset, int length) { oldApiCheckStateBeforeInput(length).checkIsOk(); ByteBuffer inputBuffer = getInputBuffer(); int numberOfBytesConsumed = pourArrayToBuffer(bytes, offset, length, inputBuffer); processInput().checkIsOk(); return numberOfBytesConsumed; }
@Override public int input(byte[] bytes, int offset, int length) { oldApiCheckStateBeforeInput(length).checkIsOk(); ByteBuffer inputBuffer = getInputBuffer(); int numberOfBytesConsumed = pourArrayToBuffer(bytes, offset, length, inputBuffer); processInput().checkIsOk(); return numberOfBytesConsumed; }
/** * This method is public as it is used by Python layer. * @see org.apache.qpid.proton.engine.Transport#input(byte[], int, int) */ public TransportResult oldApiCheckStateBeforeInput(int inputLength) { _lastTransportResult.checkIsOk(); if(inputLength == 0) { if(_connectionEndpoint == null || _connectionEndpoint.getRemoteState() != EndpointState.CLOSED) { return TransportResultFactory.error(new TransportException("Unexpected EOS when remote connection not closed: connection aborted")); } } return TransportResultFactory.ok(); }
/** * This method is public as it is used by Python layer. * @see org.apache.qpid.proton.engine.Transport#input(byte[], int, int) */ public TransportResult oldApiCheckStateBeforeInput(int inputLength) { _lastTransportResult.checkIsOk(); if(inputLength == 0) { if(_connectionEndpoint == null || _connectionEndpoint.getRemoteState() != EndpointState.CLOSED) { return TransportResultFactory.error(new TransportException("Unexpected EOS when remote connection not closed: connection aborted")); } } return TransportResultFactory.ok(); }
/** * This method is public as it is used by Python layer. * @see Transport#input(byte[], int, int) */ public TransportResult oldApiCheckStateBeforeInput(int inputLength) { _lastTransportResult.checkIsOk(); if(inputLength == 0) { if(_connectionEndpoint == null || _connectionEndpoint.getRemoteState() != EndpointState.CLOSED) { return TransportResultFactory.error(new TransportException("Unexpected EOS when remote connection not closed: connection aborted")); } } return TransportResultFactory.ok(); }