org.webpieces.http2client.impl.Layer3Outgoing Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http2-client Show documentation
Show all versions of http2-client Show documentation
Strictly an http/2 client for when you know the server does http2 keeping it KISS
package org.webpieces.http2client.impl;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.util.concurrent.CompletableFuture;
import org.webpieces.http2client.api.Http2Socket;
import org.webpieces.nio.api.channels.TCPChannel;
import org.webpieces.util.logging.Logger;
import org.webpieces.util.logging.LoggerFactory;
import com.webpieces.http2engine.api.client.ClientEngineListener;
import com.webpieces.http2engine.api.error.ShutdownConnection;
import com.webpieces.http2parser.api.dto.lib.Http2Frame;
public class Layer3Outgoing implements ClientEngineListener {
private static final Logger log = LoggerFactory.getLogger(Layer3Outgoing.class);
private TCPChannel channel;
public Layer3Outgoing(TCPChannel channel, Http2Socket socket) {
this.channel = channel;
}
@Override
public CompletableFuture sendToSocket(ByteBuffer data) {
log.trace(() -> channel+"writing out data to socket size="+data.remaining());
return channel.write(data)
.thenApply(c -> null);
}
public void sendPreface(ByteBuffer buf) {
channel.write(buf);
}
public CompletableFuture connect(InetSocketAddress addr, Layer1Incoming incoming) {
return channel.connect(addr, incoming);
}
public CompletableFuture close() {
return channel.close();
}
@Override
public void sendControlFrameToClient(Http2Frame lowLevelFrame) {
}
@Override
public void engineClosedByFarEnd() {
}
@Override
public void closeSocket(ShutdownConnection reason) {
channel.close();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy