Issue with "Basic networking code" (Listing 25.3)

I have an issue with the code in Listing 25.3 (I added log for the bytes in InputStream)

public byte[] getUrlBytes(String urlSpec) throws IOException {
                URL url = new URL(urlSpec);
                HttpURLConnection connection = (HttpURLConnection)url.openConnection();
                try {
                     ByteArrayOutputStream out = new ByteArrayOutputStream();
                     InputStream in = connection.getInputStream();
                     if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
                          throw new IOException(connection.getResponseMessage() +
                                ": with " + urlSpec);

                    int bytesRead = 0;
                    byte[] buffer = new byte[1024];
                    while ((bytesRead = > 0) {
                            Log.i("PhotoGalleryFragment", String.valueOf(bytesRead));
                           out.write(buffer, 0, bytesRead);

                    return out.toByteArray();
        } finally {

I can’t get the full web page like in Figure 25.5 using Listing 25.6 (Writing an AsyncTask, part II)
I just get part of the Big Nerd Ranch web page:

So why is that?
It has to do with AsyncTask?

On the log there’s logs with the Tag “chatty”, it has something to do with no getting the whole page?