public class SPDYClient extends Object
SPDYClient allows applications to connect to one or more SPDY servers,
obtaining Session objects that can be used to send/receive SPDY frames.
SPDYClient instances are created through a SPDYClient.Factory:
SPDYClient.Factory factory = new SPDYClient.Factory(); SPDYClient client = factory.newSPDYClient(SPDY.V3);and then used to connect to the server:
FuturePromise<Session> promise = new FuturePromise<>();
client.connect("server.com", null, promise);
Session session = promise.get();
| Modifier and Type | Class and Description |
|---|---|
static class |
SPDYClient.Factory |
| Modifier | Constructor and Description |
|---|---|
protected |
SPDYClient(short version,
SPDYClient.Factory factory) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configure(SocketChannel channel) |
Session |
connect(SocketAddress address,
SessionFrameListener listener)
Equivalent to:
|
void |
connect(SocketAddress address,
SessionFrameListener listener,
Promise<Session> promise)
Equivalent to:
|
void |
connect(SocketAddress address,
SessionFrameListener listener,
Promise<Session> promise,
Map<String,Object> context)
Connects to the given
address, binding the given listener to session events,
and notified the given promise of the connect result. |
SocketAddress |
getBindAddress() |
ClientConnectionFactory |
getClientConnectionFactory() |
SPDYClient.Factory |
getFactory() |
long |
getIdleTimeout() |
int |
getInitialWindowSize() |
short |
getVersion() |
boolean |
isDispatchIO() |
protected FlowControlStrategy |
newFlowControlStrategy() |
void |
setBindAddress(SocketAddress bindAddress) |
void |
setClientConnectionFactory(ClientConnectionFactory connectionFactory) |
void |
setDispatchIO(boolean dispatchIO) |
void |
setIdleTimeout(long idleTimeout) |
void |
setInitialWindowSize(int initialWindowSize) |
protected SPDYClient(short version,
SPDYClient.Factory factory)
public short getVersion()
public SPDYClient.Factory getFactory()
public Session connect(SocketAddress address, SessionFrameListener listener) throws ExecutionException, InterruptedException
Future<Session> promise = new FuturePromise<>(); connect(address, listener, promise);
address - the address to connect tolistener - the session listener that will be notified of session eventsSession when connectedExecutionExceptionInterruptedExceptionpublic void connect(SocketAddress address, SessionFrameListener listener, Promise<Session> promise)
connect(address, listener, promise, null);
address - the address to connect tolistener - the session listener that will be notified of session eventspromise - the promise notified of connection success/failurepublic void connect(SocketAddress address, SessionFrameListener listener, Promise<Session> promise, Map<String,Object> context)
address, binding the given listener to session events,
and notified the given promise of the connect result.
If the connect operation is successful, the promise will be invoked with the Session
object that applications can use to perform SPDY requests.address - the address to connect tolistener - the session listener that will be notified of session eventspromise - the promise notified of connection success/failurecontext - a context object passed to the ConnectionFactory
for the creation of the connectionprotected void configure(SocketChannel channel) throws IOException
IOExceptionpublic SocketAddress getBindAddress()
setBindAddress(SocketAddress)public void setBindAddress(SocketAddress bindAddress)
bindAddress - the address to bind the socket channel togetBindAddress()public long getIdleTimeout()
public void setIdleTimeout(long idleTimeout)
public int getInitialWindowSize()
public void setInitialWindowSize(int initialWindowSize)
public boolean isDispatchIO()
public void setDispatchIO(boolean dispatchIO)
public ClientConnectionFactory getClientConnectionFactory()
public void setClientConnectionFactory(ClientConnectionFactory connectionFactory)
protected FlowControlStrategy newFlowControlStrategy()
Copyright © 1995-2015 Webtide. All Rights Reserved.