当前位置: 首页>>代码示例>>Java>>正文


Java TransportException类代码示例

本文整理汇总了Java中org.apache.qpid.proton.engine.TransportException的典型用法代码示例。如果您正苦于以下问题:Java TransportException类的具体用法?Java TransportException怎么用?Java TransportException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TransportException类属于org.apache.qpid.proton.engine包,在下文中一共展示了TransportException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: pourAll

import org.apache.qpid.proton.engine.TransportException; //导入依赖的package包/类
/**
 * Pours the contents of {@code source} into {@code destinationTransportInput}, calling
 * the TransportInput many times if necessary.  If the TransportInput returns a {@link org.apache.qpid.proton.engine.TransportResult}
 * other than ok, data may remain in source.
 */
public static int pourAll(ByteBuffer source, TransportInput destinationTransportInput) throws TransportException
{
    int capacity = destinationTransportInput.capacity();
    if (capacity == Transport.END_OF_STREAM)
    {
        if (source.hasRemaining()) {
            throw new IllegalStateException("Destination has reached end of stream: " +
                                            destinationTransportInput);
        } else {
            return Transport.END_OF_STREAM;
        }
    }

    int total = source.remaining();

    while(source.hasRemaining() && destinationTransportInput.capacity() > 0)
    {
        pour(source, destinationTransportInput.tail());
        destinationTransportInput.process();
    }

    return total - source.remaining();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:29,代码来源:ByteBufferUtils.java

示例2: readPemObject

import org.apache.qpid.proton.engine.TransportException; //导入依赖的package包/类
private Object readPemObject(String pemFile)
{
    Reader reader = null;
    Object pemParser = null;
    Object pemObject = null;

    try
    {
        reader = new FileReader(pemFile);
        pemParser = pemParserCons.newInstance(reader); // = new PEMParser(reader);
        pemObject = pemReadMethod.invoke(pemParser); // = pemParser.readObject();
    }
    catch (IOException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException e)
    {
        _logger.log(Level.SEVERE, "Unable to read PEM object. Perhaps you need the unlimited strength libraries in <java-home>/jre/lib/security/ ?", e);
        throw new TransportException("Unable to read PEM object from file " + pemFile, e);
    }
    finally
    {
        closeSafely(reader);
    }

    return pemObject;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:25,代码来源:SslEngineFacadeFactory.java

示例3: process

import org.apache.qpid.proton.engine.TransportException; //导入依赖的package包/类
@Override
public void process() throws TransportException
{
    if (_tail_closed) throw new TransportException("tail closed");

    _inputBuffer.flip();

    try {
        unwrapInput();
    } catch (SSLException e) {
        _logger.log(Level.WARNING, e.getMessage());
        _inputBuffer.position(_inputBuffer.limit());
        _tail_closed = true;
    } finally {
        _inputBuffer.compact();
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:18,代码来源:SimpleSslTransportWrapper.java

示例4: initTransportWrapperOnFirstIO

import org.apache.qpid.proton.engine.TransportException; //导入依赖的package包/类
private void initTransportWrapperOnFirstIO()
{
    try {
        if (_initException == null && _transportWrapper == null)
        {
            SslTransportWrapper sslTransportWrapper = new SimpleSslTransportWrapper
                (_protonSslEngineProvider.createSslEngine(_peerDetails),
                 _inputProcessor, _outputProcessor);

            if (_domain.allowUnsecuredClient() && _domain.getMode() == SslDomain.Mode.SERVER)
            {
                TransportWrapper plainTransportWrapper = new PlainTransportWrapper
                    (_outputProcessor, _inputProcessor);
                _transportWrapper = new SslHandshakeSniffingTransportWrapper
                    (sslTransportWrapper, plainTransportWrapper);
            }
            else
            {
                _transportWrapper = sslTransportWrapper;
            }
        }
    } catch (TransportException e) {
        _initException = e;
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:26,代码来源:SslImpl.java

示例5: process

import org.apache.qpid.proton.engine.TransportException; //导入依赖的package包/类
@Override
public void process() throws TransportException
{
    if (isDeterminationMade())
    {
        _selectedTransportWrapper.process();
    }
    else if (_determinationBuffer.remaining() == 0)
    {
        _determinationBuffer.flip();
        byte[] bytesInput = new byte[_determinationBuffer.remaining()];
        _determinationBuffer.get(bytesInput);
        makeDetermination(bytesInput);
        _determinationBuffer.rewind();

        // TODO what if the selected transport has insufficient capacity?? Maybe use pour, and then try to finish pouring next time round.
        _selectedTransportWrapper.tail().put(_determinationBuffer);
        _selectedTransportWrapper.process();
    } else if (_tail_closed) {
        throw new TransportException("connection aborted");
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:23,代码来源:HandshakeSniffingTransportWrapper.java

示例6: testInputOfFrameWithInvalidSizeExceedingMinMaxFrameSize

import org.apache.qpid.proton.engine.TransportException; //导入依赖的package包/类
@Test
public void testInputOfFrameWithInvalidSizeExceedingMinMaxFrameSize()
{
    sendAmqpSaslHeader(_frameParserWithMockDecoder);

    // http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-security-v1.0-os.html#doc-idp43536
    // Description: '513byte sized' SASL frame header
    byte[] oversizedSaslFrameHeader = new byte[] { (byte) 0x00, 0x00, 0x02, 0x01, 0x02, 0x01, 0x00, 0x00 };

    try {
        _frameParserWithMockDecoder.input(ByteBuffer.wrap(oversizedSaslFrameHeader));
        fail("expected exception");
    } catch (TransportException e) {
        assertThat(e.getMessage(), containsString("frame size 513 larger than maximum"));
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:17,代码来源:SaslFrameParserTest.java

示例7: testInputOfFrameWithInvalidSizeWhenSpecifyingLargeMaxFrameSize

import org.apache.qpid.proton.engine.TransportException; //导入依赖的package包/类
@Test
public void testInputOfFrameWithInvalidSizeWhenSpecifyingLargeMaxFrameSize()
{
    SaslFrameParser frameParserWithLargeMaxSize = new SaslFrameParser(_mockSaslFrameHandler, _mockDecoder, 2017);
    sendAmqpSaslHeader(frameParserWithLargeMaxSize);

    // http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-security-v1.0-os.html#doc-idp43536
    // Description: '2057byte sized' SASL frame header
    byte[] oversizedSaslFrameHeader = new byte[] { (byte) 0x00, 0x00, 0x08, 0x09, 0x02, 0x01, 0x00, 0x00 };

    try {
        frameParserWithLargeMaxSize.input(ByteBuffer.wrap(oversizedSaslFrameHeader));
        fail("expected exception");
    } catch (TransportException e) {
        assertThat(e.getMessage(), containsString("frame size 2057 larger than maximum SASL frame size 2017"));
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:18,代码来源:SaslFrameParserTest.java

示例8: testInputOfFrameWithInvalidSizeBelowMinimumPossible

import org.apache.qpid.proton.engine.TransportException; //导入依赖的package包/类
@Test
public void testInputOfFrameWithInvalidSizeBelowMinimumPossible()
{
    sendAmqpSaslHeader(_frameParserWithMockDecoder);

    // http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-security-v1.0-os.html#doc-idp43536
    // Description: '7byte sized' SASL frame header
    byte[] undersizedSaslFrameHeader = new byte[] { (byte) 0x00, 0x00, 0x00, 0x07, 0x02, 0x01, 0x00, 0x00 };

    try {
        _frameParserWithMockDecoder.input(ByteBuffer.wrap(undersizedSaslFrameHeader));
        fail("expected exception");
    } catch (TransportException e) {
        assertThat(e.getMessage(), containsString("frame size 7 smaller than minimum"));
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:17,代码来源:SaslFrameParserTest.java

示例9: testInputOfFrameWithInvalidDoffBelowMinimumPossible

import org.apache.qpid.proton.engine.TransportException; //导入依赖的package包/类
@Test
public void testInputOfFrameWithInvalidDoffBelowMinimumPossible()
{
    sendAmqpSaslHeader(_frameParserWithMockDecoder);

    // http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-security-v1.0-os.html#doc-idp43536
    // Description: '8byte sized' SASL frame header with invalid doff of 1[*4 = 4bytes]
    byte[] underMinDoffSaslFrameHeader = new byte[] { (byte) 0x00, 0x00, 0x00, 0x08, 0x01, 0x01, 0x00, 0x00 };

    try {
        _frameParserWithMockDecoder.input(ByteBuffer.wrap(underMinDoffSaslFrameHeader));
        fail("expected exception");
    } catch (TransportException e) {
        assertThat(e.getMessage(), containsString("data offset 4 smaller than minimum"));
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:17,代码来源:SaslFrameParserTest.java

示例10: testInputOfFrameWithInvalidDoffAboveMaximumPossible

import org.apache.qpid.proton.engine.TransportException; //导入依赖的package包/类
@Test
public void testInputOfFrameWithInvalidDoffAboveMaximumPossible()
{
    sendAmqpSaslHeader(_frameParserWithMockDecoder);

    // http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-security-v1.0-os.html#doc-idp43536
    // Description: '8byte sized' SASL frame header with invalid doff of 3[*4 = 12bytes]
    byte[] overFrameSizeDoffSaslFrameHeader = new byte[] { (byte) 0x00, 0x00, 0x00, 0x08, 0x03, 0x01, 0x00, 0x00 };

    try {
        _frameParserWithMockDecoder.input(ByteBuffer.wrap(overFrameSizeDoffSaslFrameHeader));
        fail("expected exception");
    } catch (TransportException e) {
        assertThat(e.getMessage(), containsString("data offset 12 larger than the frame size 8"));
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:17,代码来源:SaslFrameParserTest.java

示例11: process

import org.apache.qpid.proton.engine.TransportException; //导入依赖的package包/类
@Override
public void process() throws TransportException
{
    _processCount++;

    initIntermediateBuffer();

    if(_nextError != null)
    {
        throw new TransportException(_nextError);
    }

    _buffer.flip();
    byte[] receivedInputBuffer = new byte[_buffer.remaining()];
    _buffer.get(receivedInputBuffer);
    _buffer.compact();
    _receivedInput.append(new String(receivedInputBuffer));
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:19,代码来源:RememberingTransportInput.java

示例12: testTooFewBytesToMakeDetermination

import org.apache.qpid.proton.engine.TransportException; //导入依赖的package包/类
@Test
public void testTooFewBytesToMakeDetermination()
{
    byte[] sourceBuffer = new byte[] {0x00};

    try
    {
        _sniffingWrapper.tail().put(sourceBuffer);
        _sniffingWrapper.close_tail();

        _expectedException.expect(TransportException.class);
        _sniffingWrapper.process();
    }
    finally
    {
        verifyZeroInteractions(_secureTransportWrapper, _plainTransportWrapper);
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:19,代码来源:SslHandshakeSniffingTransportWrapperTest.java

示例13: pumpInbound

import org.apache.qpid.proton.engine.TransportException; //导入依赖的package包/类
private void pumpInbound(ByteBuffer bytes) {
  if (failed) {
    LOG.trace("Skipping processing of data following transport error: {0}", bytes);
    return;
  }

  // Lets push bytes from vert.x to proton engine.
  ByteBuffer inputBuffer = transport.getInputBuffer();
  while (bytes.hasRemaining() && inputBuffer.hasRemaining() && !failed) {
    inputBuffer.put(bytes.get());
    try {
      transport.processInput().checkIsOk();
    } catch (TransportException te) {
      failed = true;
      LOG.trace("Exception while processing transport input", te);
    }
  }
}
 
开发者ID:vert-x3,项目名称:vertx-proton,代码行数:19,代码来源:ProtonTransport.java

示例14: oldApiCheckStateBeforeInput

import org.apache.qpid.proton.engine.TransportException; //导入依赖的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();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:17,代码来源:TransportImpl.java

示例15: processInput

import org.apache.qpid.proton.engine.TransportException; //导入依赖的package包/类
@Override
public TransportResult processInput()
{
    try {
        process();
        return TransportResultFactory.ok();
    } catch (TransportException e) {
        return TransportResultFactory.error(e);
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:11,代码来源:TransportImpl.java


注:本文中的org.apache.qpid.proton.engine.TransportException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。