void sendRequest() {
            synchronized(HTTPSenderInternal.this) {
                if(connection != null)
                    throw new IllegalStateException("Request already sent");

                // If keepalive is supported, send the request immediately on the first (and
                // normally only) connection.
                //
                // Note that we place no restrictions on the number of requests that can be queued in a
                // single pipelined request.  Rate-limiting requests is the job of the caller, since only
                // new requests are rate-limited and not retransmissions (see XEP-0124 11 Overactivity).
                if(supportsKeepAlive != null && supportsKeepAlive) {
                    connection = getFirstConnection();
                    if(connection != null) {
                        // LOG.log(Level.WARNING, "Sending packet over keepalive");
                        connection.sendRequest(requestData, this);
                        return;
                    }
                    // LOG.log(Level.WARNING, "No connection took our packet");
                }

                SSLConnector sslConnector = cfg.getSSLConnector();
                if(sslConnector == null) {
                    final SSLContext sslContext = cfg.getSSLContext();
                    if(sslContext != null) {
                        sslConnector = new SSLConnector() {
                            public SSLSocket attachSSLConnection(Socket socket, String host, int port) throws IOException {
                                return (SSLSocket) sslContext.getSocketFactory().createSocket(socket, host, port, true);
                            }
                        };
                    } else {
                        sslConnector = SSLConnector.getDefault();
                    }
                }

                // Creating the InternalHTTPConnection will never block, so this is safe to call
                // while synchronized.
                connection = new InternalHTTPConnection<InternalHTTPResponse>(cfg.getURI(),
                        cfg.getSocketFactory(), cfg.getSocketConnectorFactory(), sslConnector);
                connections.add(connection);

                // Send the request over the connection we just created.
                connection.sendRequest(requestData, this);

                // Notify any blocking awaitResponse call that the connection is available.
                HTTPSenderInternal.this.notifyAll();
            }
        }