Search in sources :

Example 6 with HttpSocket

use of org.webpieces.httpclient11.api.HttpSocket in project webpieces by deanhiller.

the class DirectHttp11Client method createHttpSocket.

public HttpSocket createHttpSocket(HttpSocketListener closeListener) {
    ConnectionListener listener = mgr.getHttpConnection();
    MockTcpChannel channel = new MockTcpChannel(false);
    return new HttpSocketImpl(new DelayedProxy(listener, channel), parser, closeListener, false);
// return new Http11SocketImpl(listener, channel, parser, false);
}
Also used : MockTcpChannel(org.webpieces.webserver.test.MockTcpChannel) ConnectionListener(org.webpieces.nio.api.handlers.ConnectionListener) HttpSocketImpl(org.webpieces.httpclient11.impl.HttpSocketImpl)

Example 7 with HttpSocket

use of org.webpieces.httpclient11.api.HttpSocket in project webpieces by deanhiller.

the class Http2ClientProxy method createHttpSocket.

@Override
public Http2Socket createHttpSocket(Http2SocketListener listener) {
    Http11CloseListener http11Listener = new Http11CloseListener(listener);
    HttpSocket socket11 = client11.createHttpSocket(http11Listener);
    Http2SocketImpl http2Socket = new Http2SocketImpl(socket11);
    http11Listener.setHttp2Socket(http2Socket);
    return http2Socket;
}
Also used : HttpSocket(org.webpieces.httpclient11.api.HttpSocket)

Example 8 with HttpSocket

use of org.webpieces.httpclient11.api.HttpSocket in project webpieces by deanhiller.

the class DirectHttp11Client method createHttpsSocket.

public HttpSocket createHttpsSocket(SSLEngine engine, HttpSocketListener closeListener) {
    ConnectionListener listener = mgr.getHttpsConnection();
    MockTcpChannel channel = new MockTcpChannel(true);
    return new HttpSocketImpl(new DelayedProxy(listener, channel), parser, closeListener, true);
}
Also used : MockTcpChannel(org.webpieces.webserver.test.MockTcpChannel) ConnectionListener(org.webpieces.nio.api.handlers.ConnectionListener) HttpSocketImpl(org.webpieces.httpclient11.impl.HttpSocketImpl)

Example 9 with HttpSocket

use of org.webpieces.httpclient11.api.HttpSocket in project webpieces by deanhiller.

the class AbstractWebpiecesTest method connectHttp.

// public HttpSocket connectHttpLocal() {
// try {
// return connectHttp(false, null);
// } catch (InterruptedException | ExecutionException | TimeoutException e) {
// throw SneakyThrow.sneak(e);
// }
// }
// 
// public HttpSocket connectHttpsLocal() {
// try {
// return connectHttps(false, null, null);
// } catch (InterruptedException | ExecutionException | TimeoutException e) {
// throw SneakyThrow.sneak(e);
// }
// }
/**
 * @deprecated Use connectHttp with no isRemote parameter AND override isRemote() IF you need
 */
@Deprecated
public HttpSocket connectHttp(boolean isRemote, InetSocketAddress addr) throws InterruptedException, ExecutionException, TimeoutException {
    NullHttp1CloseListener listener = new NullHttp1CloseListener();
    HttpSocket socket = getClient(isRemote).createHttpSocket(listener);
    XFuture<Void> connect = socket.connect(addr);
    connect.get(2, TimeUnit.SECONDS);
    return socket;
}
Also used : HttpSocket(org.webpieces.httpclient11.api.HttpSocket)

Example 10 with HttpSocket

use of org.webpieces.httpclient11.api.HttpSocket in project webpieces by deanhiller.

the class AbstractWebpiecesTest method connectHttps.

/**
 * @deprecated Use connectHttp with no isRemote parameter AND override isRemote() IF you need
 */
@Deprecated
public HttpSocket connectHttps(boolean isRemote, SSLEngine engine, InetSocketAddress addr) throws InterruptedException, ExecutionException, TimeoutException {
    NullHttp1CloseListener listener = new NullHttp1CloseListener();
    HttpSocket socket = getClient(isRemote).createHttpsSocket(engine, listener);
    XFuture<Void> connect = socket.connect(addr);
    connect.get(2, TimeUnit.SECONDS);
    return socket;
}
Also used : HttpSocket(org.webpieces.httpclient11.api.HttpSocket)

Aggregations

HttpSocket (org.webpieces.httpclient11.api.HttpSocket)10 SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)3 ExecutionException (java.util.concurrent.ExecutionException)2 TimeoutException (java.util.concurrent.TimeoutException)2 HttpClient (org.webpieces.httpclient11.api.HttpClient)2 HttpSocketImpl (org.webpieces.httpclient11.impl.HttpSocketImpl)2 ConnectionListener (org.webpieces.nio.api.handlers.ConnectionListener)2 MockTcpChannel (org.webpieces.webserver.test.MockTcpChannel)2 Metrics (io.micrometer.core.instrument.Metrics)1 InetSocketAddress (java.net.InetSocketAddress)1 Executor (java.util.concurrent.Executor)1 Executors (java.util.concurrent.Executors)1 Before (org.junit.Before)1 Test (org.junit.Test)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 BufferPool (org.webpieces.data.api.BufferPool)1 DataWrapper (org.webpieces.data.api.DataWrapper)1 TwoPools (org.webpieces.data.api.TwoPools)1 HttpClientFactory (org.webpieces.httpclient11.api.HttpClientFactory)1