All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.webpieces.http2client.impl.Http2ChannelProxyImpl Maven / Gradle / Ivy

There is a newer version: 2.1.109
Show newest version
package org.webpieces.http2client.impl;

import java.net.InetSocketAddress;
import java.nio.ByteBuffer;

import org.webpieces.util.HostWithPort;
import org.webpieces.util.futures.XFuture;

import org.webpieces.nio.api.channels.TCPChannel;
import org.webpieces.nio.api.handlers.DataListener;

public class Http2ChannelProxyImpl implements Http2ChannelProxy {

	private TCPChannel channel;

	public Http2ChannelProxyImpl(TCPChannel channel) {
		this.channel = channel;
	}

	@Override
	public XFuture write(ByteBuffer data) {
		return channel.write(data);
	}

	@Override
	public XFuture connect(HostWithPort addr, DataListener listener) {
		if(addr == null)
			throw new IllegalArgumentException("addr cannot be null");

		return channel.connect(addr, listener);
	}

	/**
	 * @deprecated
	 */
	@Deprecated
	@Override
	public XFuture connect(InetSocketAddress addr, DataListener listener) {
		if(addr == null)
			throw new IllegalArgumentException("addr cannot be null");
		
		return channel.connect(addr, listener);
	}

	@Override
	public XFuture close() {
		return channel.close();
	}

	@Override
	public String toString() {
		return channel + "";
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy