Upgrade Bouncy Castle implementation to 1.48

Prepare for subjectAltName extension.
Show finest messages too, allow custom console LogLevel
logger: Use different method to enforce auto-scroll

Prevent WebScarab from crashing after logging binary data:

java.util.logging.ErrorManager: 1
java.lang.IllegalArgumentException: TextHitInfo is out of range
        at java.awt.font.TextLayout.checkTextHit(TextLayout.java:771)
        at java.awt.font.TextLayout.getCaretInfo(TextLayout.java:1211)
        at java.awt.font.TextLayout.getCaretInfo(TextLayout.java:1313)
        at javax.swing.text.GlyphPainter2.getSpan(GlyphPainter2.java:82)
        at javax.swing.text.GlyphView.getPartialSpan(GlyphView.java:330)
        at javax.swing.text.GlyphView.getMinimumSpan(GlyphView.java:556)
        at javax.swing.text.ParagraphView.calculateMinorAxisRequirements(ParagraphView.java:731)
        at javax.swing.plaf.basic.BasicTextAreaUI$PlainParagraph.calculateMinorAxisRequirements(BasicTextAreaUI.java:272)
        at javax.swing.text.BoxView.checkRequests(BoxView.java:935)
        at javax.swing.text.BoxView.getMinimumSpan(BoxView.java:568)
        at javax.swing.text.BoxView.calculateMinorAxisRequirements(BoxView.java:903)
        at javax.swing.text.BoxView.checkRequests(BoxView.java:935)
        at javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:343)
        at javax.swing.text.BoxView.layout(BoxView.java:708)
        at javax.swing.text.BoxView.setSize(BoxView.java:397)
        at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1714)
        at javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:1046)
        at org.owasp.webscarab.ui.swing.UIFramework$TextScroller.insertUpdate(UIFramework.java:919)
        at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:202)
        at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:749)
        at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:708)
        at javax.swing.text.PlainDocument.insertString(PlainDocument.java:130)
        at org.owasp.webscarab.util.swing.DocumentHandler$1.run(DocumentHandler.java:97)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727)
        at java.awt.EventQueue.access$200(EventQueue.java:103)
        at java.awt.EventQueue$3.run(EventQueue.java:688)
        at java.awt.EventQueue$3.run(EventQueue.java:686)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:697)
        at org.owasp.webscarab.util.swing.TextComponentContextMenu.dispatchEvent(TextComponentContextMenu.java:32)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Strip "invisible" control characters from log output

The log output is also written to the console where certain characters have
a special meaning. ESC can be used to change colors, BEL rings the bell, DEL
removes the previous character... these side-effects are unwanted, hence remove
it from the log output.
Add wrapper classes for InputStream and Socket

This is in preparation of supporting SNI when a client specifies an IP address
in a CONNECT request, instead of a DNS host name.

The `CONNECT ip:port HTTP/1.0` behavior was observed with certain Android
clients. In order to reproduce it locally, I setup a socat instance that
transparently proxies all requests to WebScarab with an IP address.

    socat TCP-LISTEN:443,fork PROXY:127.0.0.1:178.21.112.251:443,proxyport=8008
    curl -4 -vvv -k --resolve lekensteyn.nl:443:127.0.0.1 https://lekensteyn.nl
Enable SNI support for WebScarab in the server role

Before this patch, WebScarab will always create a certificate based on the host
given in the CONNECT line. Some clients send an IP address in the CONNECT line
and put the domain name in the TLS ClientHello message. This causes a mismatch
between the name on the certificate (IP address) and the expected value (a
domain name).

Since the host name passed to the negiotiateSSL (SSLSocketFactory.createSocket)
is used for the certificate name, the real host name must be determined before
that (before the SSLSocket is set up). Therefore, wrap the socket in a
WireSocket such that the ClientHello message can be captured and the Server Name
can be extracted.

Once a SNI host name is found, the `_base` URL is rebased on this host name.
This changes the certificate name and replaces the host that is visible in the
UI and logs.
Copy CN and SAN from server certificate.

Previously, the following happens for a connection setup:
1. Client sends CONNECT example.com:443
2. Server creates a certificate for example.com and gives it to the client.
3. Client continues TLS handshake and sends the actual request, encrypted.
4. Server connects to example.com:443, established a secure connection and
   performs the request. It then writes the response back to the client.

This has generally worked well, but I found an Android client that connects to
an IP address (192.0.2.0:443) and does not use SNI to make clear that it
actually wanted "example.com". Instead, it connects to an IP address and
compares the names on the certificate with a string in the application code.
Since my goal is to make WS as transparant as possible, I changed the order to:
1. Client sends CONNECT 192.0.2.0:443
2. Server reads the following ClientHello from the client and searches for SNI
   server name.
3. Server connects to 192.0.2.0:443, sending the SNI server name if any.
4. Server retrieves certificates from 192.0.2.0:443.
5. Server generates a certificate based on the 192.0.2.0:443 certificate.
6. Server finishes handshake with client.
7. Client sends the actual request, encrypted.
8. Server reuses the connection to 192.0.2.0:443 and performs the request. It
   then writes the response back to the client.

This new approach may introduce slightly more delay since the client TLS
handshake is now completed when the server established a TLS connection with the
requested server. Previously the client could start sending data immediately
after sending the CONNECT line to WS.

Currently, the Subject field and subjectAlternateNames fields are copied from
the original certificate, disregarding the requested host name or IP address.
If the client gets a warning because of a domain name mismatch when connecting
directly, it will now also get that warning when connecting via WS. (It also
means that the above Android client does not complain about the names anymore.)

For that Android client, WS will still use the IP address in the logs though.
(WS cannot know which host name the Android client is comparing to.)
Debug log certificate from server