// Now we have a tunnel to the target. As we will be creating a
// layered TLS/SSL socket immediately afterwards, updating the
// connection with the new target is optional - but good style.
// The scheme part of the target is already "https", though the
// connection is not yet switched to the TLS/SSL protocol.
conn.update(null, target, false, getParams());
System.out.println("layering secure connection");
scop.updateSecureConnection(conn, target, ctx, getParams());
// finally we have the secure connection and can send the request