类java.nio.channels.NoConnectionPendingException源码实例Demo

下面列出了怎么用java.nio.channels.NoConnectionPendingException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Bytecoder   文件: SocketChannelImpl.java
/**
 * Marks the beginning of a finishConnect operation that might block.
 *
 * @throws ClosedChannelException if the channel is closed
 * @throws NoConnectionPendingException if no connection is pending
 */
private void beginFinishConnect(boolean blocking) throws ClosedChannelException {
    if (blocking) {
        // set hook for Thread.interrupt
        begin();
    }
    synchronized (stateLock) {
        ensureOpen();
        if (state != ST_CONNECTIONPENDING)
            throw new NoConnectionPendingException();
        if (blocking) {
            // record thread so it can be signalled if needed
            readerThread = NativeThread.current();
        }
    }
}
 
源代码2 项目: j2objc   文件: SocketChannelTest.java
/**
 * finish-->connect-->finish-->close
 */
public void testCFII_FinishFirst_Server_Block() throws Exception {
    // ensure
    ensureServerOpen();
    assertTrue(this.channel1.isBlocking());
    statusNotConnected_NotPending();
    // finish
    try {
        this.channel1.finishConnect();
        fail("Should throw NoConnectionPendingException");
    } catch (NoConnectionPendingException e) {
        // OK.
    }
    statusNotConnected_NotPending();
    // connect
    assertTrue(this.channel1.connect(localAddr1));
    statusConnected_NotPending();

    tryFinish();

    this.channel1.close();
    statusChannelClosed();

}
 
源代码3 项目: j2objc   文件: SocketChannelTest.java
/**
 * finish-->connect-->finish-->close
 */
public void testCFII_FinishFirst_Server_NonBlock() throws Exception {
    // ensure
    ensureServerOpen();
    this.channel1.configureBlocking(false);
    statusNotConnected_NotPending();
    // finish
    try {
        this.channel1.finishConnect();
        fail("Should throw NoConnectionPendingException");
    } catch (NoConnectionPendingException e) {
        // OK.
    }
    statusNotConnected_NotPending();
    // connect
    boolean connected = channel1.connect(localAddr1);
    if (!connected) {
        statusNotConnected_Pending();
    }
    tryFinish();

    this.channel1.close();
    statusChannelClosed();
}
 
源代码4 项目: j2objc   文件: NoConnectionPendingExceptionTest.java
/**
 * @tests {@link java.nio.channels.NoConnectionPendingException#NoConnectionPendingException()}
 */
public void test_Constructor() {
    NoConnectionPendingException e = new NoConnectionPendingException();
    assertNull(e.getMessage());
    assertNull(e.getLocalizedMessage());
    assertNull(e.getCause());
}
 
源代码5 项目: j2objc   文件: NoConnectionPendingExceptionTest.java
/**
 * @tests serialization/deserialization compatibility.
 */
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new NoConnectionPendingException());
}
 
源代码6 项目: j2objc   文件: NoConnectionPendingExceptionTest.java
/**
 * @tests serialization/deserialization compatibility with RI.
 */
public void testSerializationCompatibility() throws Exception {

    SerializationTest
            .verifyGolden(this, new NoConnectionPendingException());
}
 
 类所在包
 同包方法