java.nio.channels.NoConnectionPendingException Java Examples
The following examples show how to use
java.nio.channels.NoConnectionPendingException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SocketChannelImpl.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * 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(); } } }
Example #2
Source File: SocketChannelTest.java From j2objc with Apache License 2.0 | 6 votes |
/** * 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(); }
Example #3
Source File: SocketChannelTest.java From j2objc with Apache License 2.0 | 6 votes |
/** * 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(); }
Example #4
Source File: NoConnectionPendingExceptionTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * @tests {@link java.nio.channels.NoConnectionPendingException#NoConnectionPendingException()} */ public void test_Constructor() { NoConnectionPendingException e = new NoConnectionPendingException(); assertNull(e.getMessage()); assertNull(e.getLocalizedMessage()); assertNull(e.getCause()); }
Example #5
Source File: NoConnectionPendingExceptionTest.java From j2objc with Apache License 2.0 | 4 votes |
/** * @tests serialization/deserialization compatibility. */ public void testSerializationSelf() throws Exception { SerializationTest.verifySelf(new NoConnectionPendingException()); }
Example #6
Source File: NoConnectionPendingExceptionTest.java From j2objc with Apache License 2.0 | 4 votes |
/** * @tests serialization/deserialization compatibility with RI. */ public void testSerializationCompatibility() throws Exception { SerializationTest .verifyGolden(this, new NoConnectionPendingException()); }