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


Java ConnectionPendingException类代码示例

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


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

示例1: connect

import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
public boolean connect (SocketAddress remote, int timeout) throws IOException
{
  if (!isOpen())
    throw new ClosedChannelException();

  if (isConnected())
    throw new AlreadyConnectedException();

  if (connectionPending)
    throw new ConnectionPendingException();

  if (!(remote instanceof InetSocketAddress))
    throw new UnsupportedAddressTypeException();

  connectAddress = (InetSocketAddress) remote;

  if (connectAddress.isUnresolved())
    throw new UnresolvedAddressException();

  connected = channel.connect(connectAddress, timeout);
  connectionPending = !connected;
  return connected;
}
 
开发者ID:vilie,项目名称:javify,代码行数:24,代码来源:SocketChannelImpl.java

示例2: connect

import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
public boolean connect (SocketAddress remote, int timeout) throws IOException
{
  if (!isOpen())
    throw new ClosedChannelException();
  
  if (isConnected())
    throw new AlreadyConnectedException();

  if (connectionPending)
    throw new ConnectionPendingException();

  if (!(remote instanceof InetSocketAddress))
    throw new UnsupportedAddressTypeException();
  
  connectAddress = (InetSocketAddress) remote;

  if (connectAddress.isUnresolved())
    throw new UnresolvedAddressException();
  
  connected = channel.connect(connectAddress, timeout);
  connectionPending = !connected;
  return connected;
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:24,代码来源:SocketChannelImpl.java

示例3: testSerializationSelf

import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
/**
 * @tests serialization/deserialization compatibility.
 */
@TestTargets({
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        notes = "Verifies serialization/deserialization compatibility.",
        method = "!SerializationSelf",
        args = {}
    ),
    @TestTargetNew(
        level = TestLevel.PARTIAL_COMPLETE,
        notes = "Verifies serialization/deserialization compatibility.",
        method = "ConnectionPendingException",
        args = {}
    )
})
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new ConnectionPendingException());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:ConnectionPendingExceptionTest.java

示例4: testSerializationCompatibility

import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
/**
 * @tests serialization/deserialization compatibility with RI.
 */
@TestTargets({
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        notes = "Verifies serialization/deserialization compatibility.",
        method = "!SerializationGolden",
        args = {}
    ),
    @TestTargetNew(
        level = TestLevel.PARTIAL_COMPLETE,
        notes = "Verifies serialization/deserialization compatibility.",
        method = "ConnectionPendingException",
        args = {}
    )
})
public void testSerializationCompatibility() throws Exception {

    SerializationTest.verifyGolden(this, new ConnectionPendingException());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:ConnectionPendingExceptionTest.java

示例5: ensureOpenAndUnconnected

import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
private void ensureOpenAndUnconnected() throws IOException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (isConnected())
            throw new AlreadyConnectedException();
        if (state == ChannelState.PENDING)
            throw new ConnectionPendingException();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:SctpChannelImpl.java

示例6: checkUnconnected

import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
synchronized private void checkUnconnected() throws IOException {
    if (!isOpen()) {
        throw new ClosedChannelException();
    }
    if (status == SOCKET_STATUS_CONNECTED) {
        throw new AlreadyConnectedException();
    }
    if (status == SOCKET_STATUS_PENDING) {
        throw new ConnectionPendingException();
    }
}
 
开发者ID:Sellegit,项目名称:j2objc,代码行数:12,代码来源:SocketChannelImpl.java

示例7: bind

import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
@Override
public void bind(SocketAddress localAddr) throws IOException {
    if (channel.isConnected()) {
        throw new AlreadyConnectedException();
    }
    if (SocketChannelImpl.SOCKET_STATUS_PENDING == channel.status) {
        throw new ConnectionPendingException();
    }
    super.bind(localAddr);
    channel.onBind(false);
}
 
开发者ID:Sellegit,项目名称:j2objc,代码行数:12,代码来源:SocketChannelImpl.java

示例8: bind

import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
@Override
public void bind(SocketAddress localAddr) throws IOException {
    if (channel.isConnected()) {
        throw new AlreadyConnectedException();
    }
    if (SocketChannelImpl.SOCKET_STATUS_PENDING == channel.status) {
        throw new ConnectionPendingException();
    }
    super.bind(localAddr);
    // keep here to see if need next version
    // channel.Address = getLocalSocketAddress();
    // channel.localport = getLocalPort();
    channel.isBound = true;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:15,代码来源:SocketChannelImpl.java

示例9: test_Constructor

import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
/**
 * @tests {@link java.nio.channels.ConnectionPendingException#ConnectionPendingException()}
 */
public void test_Constructor() {
    ConnectionPendingException e = new ConnectionPendingException();
    assertNull(e.getMessage());
    assertNull(e.getLocalizedMessage());
    assertNull(e.getCause());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:10,代码来源:ConnectionPendingExceptionTest.java

示例10: bind

import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
/**
 * @see java.net.Socket#bind(java.net.SocketAddress)
 */
@Override
public void bind(SocketAddress localAddr) throws IOException {
    if (channel.isConnected()) {
        throw new AlreadyConnectedException();
    }
    if (SocketChannelImpl.SOCKET_STATUS_PENDING == channel.status) {
        throw new ConnectionPendingException();
    }
    super.bind(localAddr);
    channel.isBound = true;
    channel.localAddress = super.getLocalAddress();
    channel.localPort = super.getLocalPort();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:SocketChannelImpl.java

示例11: bind

import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
@Override
public void bind(SocketAddress localAddr) throws IOException {
    if (channel.isConnected()) {
        throw new AlreadyConnectedException();
    }
    if (SocketChannelImpl.SOCKET_STATUS_PENDING == channel.status) {
        throw new ConnectionPendingException();
    }
    super.bind(localAddr);
    // keep here to see if need next version
    // channel.Address = getLocalSocketAddress();
    // channel.localport = getLocalPort();
    channel.isBound = true;

}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:16,代码来源:SocketChannelImpl.java

示例12: testSerializationSelf

import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
/**
 * @tests serialization/deserialization compatibility.
 */
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new ConnectionPendingException());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:ConnectionPendingExceptionTest.java

示例13: testSerializationCompatibility

import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
/**
 * @tests serialization/deserialization compatibility with RI.
 */
public void testSerializationCompatibility() throws Exception {

    SerializationTest.verifyGolden(this, new ConnectionPendingException());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:ConnectionPendingExceptionTest.java


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