本文整理汇总了Java中org.apache.qpid.proton.engine.TransportResult类的典型用法代码示例。如果您正苦于以下问题:Java TransportResult类的具体用法?Java TransportResult怎么用?Java TransportResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TransportResult类属于org.apache.qpid.proton.engine包,在下文中一共展示了TransportResult类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readFromNetwork
import org.apache.qpid.proton.engine.TransportResult; //导入依赖的package包/类
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;
}
}
}
}
示例2: pumpOnce
import org.apache.qpid.proton.engine.TransportResult; //导入依赖的package包/类
private int pumpOnce(Transport transportFrom, String fromRole, Transport transportTo, String toRole)
{
int outputLength = transportFrom.pending();
if (outputLength > 0)
{
ByteBuffer outputBuffer = transportFrom.head();
int remaining = outputBuffer.remaining();
assertTrue("Unexpected remaining in buffer: " + remaining + " vs " + outputLength, remaining >= outputLength);
byte[] output = new byte[remaining];
outputBuffer.get(output);
transportFrom.pop(remaining);
ByteBuffer inputBuffer = transportTo.getInputBuffer();
inputBuffer.put(output, 0, output.length);
TransportResult result = transportTo.processInput();
result.checkIsOk();
}
return outputLength;
}
示例3: oldApiCheckStateBeforeInput
import org.apache.qpid.proton.engine.TransportResult; //导入依赖的package包/类
/**
* 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();
}
示例4: processInput
import org.apache.qpid.proton.engine.TransportResult; //导入依赖的package包/类
@Override
public TransportResult processInput()
{
try {
process();
return TransportResultFactory.ok();
} catch (TransportException e) {
return TransportResultFactory.error(e);
}
}