AndroidStudioでWebviewでステータスコードを取得するために参考サイトを見てコードを書いたのですがアプリが途中で落ちてしまいます。どうしたらアプリが落ちないようになるでしょうか?

参考
http://saki0n.blogspot.jp/2013/04/android-webview.html

public class MainActivity extends AppCompatActivity {

    private TextView textView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        WebView myWebView = (WebView) findViewById(R.id.webView);
        textView = (TextView) findViewById(R.id.textView);
        //myWebView.setWebViewClient(new WebViewClient());
        myWebView.setWebViewClient(new WebViewClient() {
            @TargetApi(Build.VERSION_CODES.HONEYCOMB)
            @Override
            public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
                if (!url.matches("https?://[\\w\\.\\-]+(/.*)?")) {
                    return super.shouldInterceptRequest(view, url);
                }
                HttpGet req = new HttpGet(url);
                DefaultHttpClient client = new DefaultHttpClient();
                String mimeType = null, encoding = null;
                byte[] data = null;
                try {
                    HttpResponse res = client.execute(req);
                    // ここでステータスコードを取得できるよ!
                    if (HttpStatus.SC_OK == res.getStatusLine().getStatusCode()) {
                        HttpEntity entity = res.getEntity();
                        Header mimeHeader = entity.getContentType();
                        textView.setText(res.getStatusLine().getStatusCode());
                        if (null != mimeHeader) mimeType = mimeHeader.getValue();
                        Header encodingHeader = entity.getContentEncoding();
                        if (null != encodingHeader) encoding = encodingHeader.getValue();
                        data = EntityUtils.toByteArray(entity);
                    }
                } catch (Exception e) {
                    String msg = e.getMessage();
                    Log.e(this.getClass().getSimpleName(), (null != msg) ? msg : "");
                } finally {
                    req.abort();
                    client.getConnectionManager().shutdown();
                }
                InputStream stream = new ByteArrayInputStream(data);
                return new WebResourceResponse(mimeType, encoding, stream);
            }
        });
        myWebView.loadUrl("https://www.google.com/");
    }
}