本文整理汇总了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;
}
示例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;
}
示例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());
}
示例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());
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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;
}
示例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());
}
示例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();
}
示例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;
}
示例12: testSerializationSelf
import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility.
*/
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new ConnectionPendingException());
}
示例13: testSerializationCompatibility
import java.nio.channels.ConnectionPendingException; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility with RI.
*/
public void testSerializationCompatibility() throws Exception {
SerializationTest.verifyGolden(this, new ConnectionPendingException());
}