Package org.xnio.http

# Class HttpUpgrade

java.lang.Object
org.xnio.http.HttpUpgrade

public class HttpUpgrade extends Object
Simple HTTP client that can perform a HTTP upgrade. This is not a general purpose HTTP client, all it can do is upgrade a HTTP

Author:
  Stuart Douglas

## Method Summary

Modifier and Type
Method
Description
`static IoFuture<StreamConnection>`
`performUpgrade(XnioWorker worker, InetSocketAddress bindAddress, URI uri, Map<String,String> headers, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, HandshakeChecker handshakeChecker)`
Connects to the target server using HTTP upgrade.
`static IoFuture<StreamConnection>`
`performUpgrade(XnioWorker worker, InetSocketAddress bindAddress, URI uri, Map<String,List<String>> headers, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, ExtendedHandshakeChecker handshakeChecker)`
Connects to the target server using HTTP upgrade.
`static IoFuture<SslConnection>`
`performUpgrade(XnioWorker worker, XnioSsl ssl, InetSocketAddress bindAddress, URI uri, Map<String,String> headers, ChannelListener<? super SslConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, HandshakeChecker handshakeChecker)`
Perform a HTTP upgrade that results in a SSL secured connection.
`static IoFuture<SslConnection>`
`performUpgrade(XnioWorker worker, XnioSsl ssl, InetSocketAddress bindAddress, URI uri, Map<String,List<String>> headers, ChannelListener<? super SslConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, ExtendedHandshakeChecker handshakeChecker)`
Perform a HTTP upgrade that results in a SSL secured connection.
`static <T extends StreamConnection>
IoFuture<T>`
`performUpgrade(T connection, URI uri, Map<String,String> headers, ChannelListener<? super StreamConnection> openListener, HandshakeChecker handshakeChecker)`
Performs a HTTP upgrade on an existing connection.
`static <T extends StreamConnection>
IoFuture<T>`
`performUpgrade(T connection, URI uri, Map<String,List<String>> headers, ChannelListener<? super StreamConnection> openListener, ExtendedHandshakeChecker handshakeChecker)`
Performs a HTTP upgrade on an existing connection.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### performUpgrade

public static IoFuture<SslConnection> performUpgrade(XnioWorker worker, XnioSsl ssl, InetSocketAddress bindAddress, URI uri, Map<String,String> headers, ChannelListener<? super SslConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, HandshakeChecker handshakeChecker)
Perform a HTTP upgrade that results in a SSL secured connection. This method should be used if the target endpoint is using https

Parameters:
  `worker` - The worker
  `ssl` - The XnioSsl instance
  `bindAddress` - The bind address
  `uri` - The URI to connect to
  `headers` - Any additional headers to include in the upgrade request. This must include an `Upgrade` header that specifies the type of upgrade being performed
  `openListener` - The open listener that is invoked once the HTTP upgrade is done
  `bindListener` - The bind listener that is invoked when the socket is bound
  `optionMap` - The option map for the connection
  `handshakeChecker` - A handshake checker that can be supplied to verify that the server returned a valid response to the upgrade request
Returns:
  An IoFuture of the connection

### performUpgrade

public static IoFuture<SslConnection> performUpgrade(XnioWorker worker, XnioSsl ssl, InetSocketAddress bindAddress, URI uri, Map<String,List<String>> headers, ChannelListener<? super SslConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, ExtendedHandshakeChecker handshakeChecker)
Perform a HTTP upgrade that results in a SSL secured connection. This method should be used if the target endpoint is using https

Parameters:
  `worker` - The worker
  `ssl` - The XnioSsl instance
  `bindAddress` - The bind address
  `uri` - The URI to connect to
  `headers` - Any additional headers to include in the upgrade request. This must include an `Upgrade` header that specifies the type of upgrade being performed
  `openListener` - The open listener that is invoked once the HTTP upgrade is done
  `bindListener` - The bind listener that is invoked when the socket is bound
  `optionMap` - The option map for the connection
  `handshakeChecker` - A handshake checker that can be supplied to verify that the server returned a valid response to the upgrade request
Returns:
  An IoFuture of the connection

### performUpgrade

public static IoFuture<StreamConnection> performUpgrade(XnioWorker worker, InetSocketAddress bindAddress, URI uri, Map<String,String> headers, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, HandshakeChecker handshakeChecker)
Connects to the target server using HTTP upgrade.

Parameters:
  `worker` - The worker
  `bindAddress` - The bind address
  `uri` - The URI to connect to
  `headers` - Any additional headers to include in the upgrade request. This must include an `Upgrade` header that specifies the type of upgrade being performed
  `openListener` - The open listener that is invoked once the HTTP upgrade is done
  `bindListener` - The bind listener that is invoked when the socket is bound
  `optionMap` - The option map for the connection
  `handshakeChecker` - A handshake checker that can be supplied to verify that the server returned a valid response to the upgrade request
Returns:
  An IoFuture of the connection

### performUpgrade

public static IoFuture<StreamConnection> performUpgrade(XnioWorker worker, InetSocketAddress bindAddress, URI uri, Map<String,List<String>> headers, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, ExtendedHandshakeChecker handshakeChecker)
Connects to the target server using HTTP upgrade.

Parameters:
  `worker` - The worker
  `bindAddress` - The bind address
  `uri` - The URI to connect to
  `headers` - Any additional headers to include in the upgrade request. This must include an `Upgrade` header that specifies the type of upgrade being performed
  `openListener` - The open listener that is invoked once the HTTP upgrade is done
  `bindListener` - The bind listener that is invoked when the socket is bound
  `optionMap` - The option map for the connection
  `handshakeChecker` - A handshake checker that can be supplied to verify that the server returned a valid response to the upgrade request
Returns:
  An IoFuture of the connection

### performUpgrade

public static <T extends StreamConnection> IoFuture<T> performUpgrade(T connection, URI uri, Map<String,String> headers, ChannelListener<? super StreamConnection> openListener, HandshakeChecker handshakeChecker)
Performs a HTTP upgrade on an existing connection.

Parameters:
  `connection` - The existing connection to upgrade
  `uri` - The URI to connect to
  `headers` - Any additional headers to include in the upgrade request. This must include an `Upgrade` header that specifies the type of upgrade being performed
  `openListener` - The open listener that is invoked once the HTTP upgrade is done
  `handshakeChecker` - A handshake checker that can be supplied to verify that the server returned a valid response to the upgrade request
Returns:
  An IoFuture of the connection

### performUpgrade

public static <T extends StreamConnection> IoFuture<T> performUpgrade(T connection, URI uri, Map<String,List<String>> headers, ChannelListener<? super StreamConnection> openListener, ExtendedHandshakeChecker handshakeChecker)
Performs a HTTP upgrade on an existing connection.

Parameters:
  `connection` - The existing connection to upgrade
  `uri` - The URI to connect to
  `headers` - Any additional headers to include in the upgrade request. This must include an `Upgrade` header that specifies the type of upgrade being performed
  `openListener` - The open listener that is invoked once the HTTP upgrade is done
  `handshakeChecker` - A handshake checker that can be supplied to verify that the server returned a valid response to the upgrade request
Returns:
  An IoFuture of the connection