Java 8 NotYetConnectedException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 NotYetConnectedException class.

This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
     
    /** 
     * @tests {@link java.nio.channels.NotYetConnectedException#NotYetConnectedException()} 
     */ 
    public void test_Constructor() { 
        NotYetConnectedException e = new NotYetConnectedException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    public void testSerializationSelf() throws Exception {
 
        SerializationTest.verifySelf(new NotYetConnectedException());
    } 
 
    /** 
6
CodeRank
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
 
    /** 
     * @tests {@link java.nio.channels.NotYetConnectedException#NotYetConnectedException()} 
     */ 
    public void test_Constructor() { 
        NotYetConnectedException e = new NotYetConnectedException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    @TestTargets({ 
        @TestTargetNew( 
            level = TestLevel.COMPLETE, 
            notes = "Verifies serialization/deserialization compatibility.", 
            method = "!SerializationSelf", 
            args = {} 
7
CodeRank
This code example shows how to use the following methods:
						WebSocket.this._send(text);
					} catch (IOException e) {
						WebSocket.this.onError(e);
					} 
				} else { 
					WebSocket.this.onError(new NotYetConnectedException());
				} 
			} 
		}).start();
	} 
 
	/** 
	 * Called when an entire text frame has been received. 
	 *  
	 * @param msg 
	 *            Message from websocket server 
	 */ 
	public void onMessage(final String msg) {
		if (listener != null)
        { 
4
CodeRank
This code example shows how to use the following methods:
						instance._send(text);
					} catch (IOException e) {
						instance.onError(e);
					} 
				} else { 
					instance.onError(new NotYetConnectedException());
				} 
			} 
		}).start();
	} 
 
	/** 
	 * Called when an entire text frame has been received. 
	 *  
	 * @param msg 
	 *            Message from websocket server 
	 */ 
	public void onMessage(final String msg) {
		appView.post(new Runnable() {
			public void run() { 
4
CodeRank
This code example shows how to use the following methods:
						instance._send(text);
					} catch (IOException e) {
						instance.onError(e);
					} 
				} else { 
					instance.onError(new NotYetConnectedException());
				} 
			} 
		}).start();
	} 
 
	// when a message is received 
	public void onMessage(final String msg) {
		// post a new thread to View 
		appView.post(new Runnable() {
			@Override 
			public void run() { 
				appView.loadUrl(buildJavaScriptData(EVENT_ON_MESSAGE, msg));
			} 
		}); 
4
CodeRank
This code example shows how to use the following methods:
						instance._send(text);
					} catch (IOException e) {
						instance.onError(e);
					} 
				} else { 
					instance.onError(new NotYetConnectedException());
				} 
			} 
		}).start();
	} 
 
 
	public void onError(final Throwable t) {
		Log.e("MonkeyPenis", t.toString());
	} 
	public void onConnect(){  
		Log.i("MonkeyPenis", "Connected");
	} 
 
	public String getId() {
4
CodeRank
This code example shows how to use the following methods:
     
  public int write (ByteBuffer src)
    throws IOException 
  { 
    if (!isConnected ()) 
      throw new NotYetConnectedException ();
     
    return channel.write(src);
  } 
 
  public long write (ByteBuffer[] srcs, int offset, int length)
    throws IOException 
  { 
    if (!isConnected()) 
      throw new NotYetConnectedException();
 
    if ((offset < 0)
        || (offset > srcs.length)
        || (length < 0)
        || (length > (srcs.length - offset)))
3
CodeRank
This code example shows how to use the following methods:
    synchronized private void checkOpenConnected() throws ClosedChannelException { 
        if (!isOpen()) {
            throw new ClosedChannelException();
        } 
        if (!isConnected()) { 
            throw new NotYetConnectedException();
        } 
    } 
 
    /* 
     * Status check, open and "unconnected", before connection. 
     */ 
    synchronized private void checkUnconnected() throws IOException { 
        if (!isOpen()) {
            throw new ClosedChannelException();
        } 
        if (status == SOCKET_STATUS_CONNECTED) {
            throw new AlreadyConnectedException();
        } 
        if (status == SOCKET_STATUS_PENDING) {
4
CodeRank
This code example shows how to use the following methods:
     * Status check, must be open and connected, for read and write. 
     */ 
    private void checkOpenConnected() throws IOException { 
        checkOpen(); 
        if (!isConnected()) { 
            throw new NotYetConnectedException();
        } 
    } 
 
    /* 
     * Buffer check, must not null 
     */ 
    private void checkNotNull(ByteBuffer source) {
        if (null == source) {
            throw new NullPointerException();
        } 
    } 
 
    /* 
     * Get the fd for internal use. 
4
CodeRank
This code example shows how to use the following methods:
     
  public int write (ByteBuffer src)
    throws IOException 
  { 
    if (!isConnected ()) 
      throw new NotYetConnectedException ();
     
    return send (src, socket.getRemoteSocketAddress());
  } 
 
  public long write (ByteBuffer[] srcs, int offset, int length)
    throws IOException 
  { 
    if (!isConnected()) 
      throw new NotYetConnectedException();
 
    if ((offset < 0)
        || (offset > srcs.length)
        || (length < 0)
        || (length > (srcs.length - offset)))
4
CodeRank
See Code Examples for Java 8 NotYetConnectedException Methods: