Code example for NotYetConnectedException

0
  } 
 
  public int read(ByteBuffer dst) throws IOException
  { 
    if (!isConnected()) 
      throw new NotYetConnectedException();
     
    byte[] data;
    int offset = 0;
    InputStream input = socket.getInputStream();
    int available = input.available();
    int len = dst.remaining();
	 
    if ((! isBlocking()) && available == 0)
      return 0; 
     
    if (dst.hasArray())
      { 
        offset = dst.arrayOffset() + dst.position();
        data = dst.array();
      }