public class LocalConnector extends AbstractConnector
HttpTester.Request request = HttpTester.newRequest(); request.setURI("/some/resource"); HttpTester.Response response = HttpTester.parseResponse(HttpTester.from(localConnector.getResponse(request.generate())));
Modifier and Type | Class and Description |
---|---|
class |
LocalConnector.LocalEndPoint
Local EndPoint
|
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Container.InheritedListener, Container.Listener
LOG
Constructor and Description |
---|
LocalConnector(Server server) |
LocalConnector(Server server,
ConnectionFactory connectionFactory) |
LocalConnector(Server server,
ConnectionFactory connectionFactory,
SslContextFactory sslContextFactory) |
LocalConnector(Server server,
Executor executor,
Scheduler scheduler,
ByteBufferPool pool,
int acceptors,
ConnectionFactory... factories) |
LocalConnector(Server server,
SslContextFactory sslContextFactory) |
Modifier and Type | Method and Description |
---|---|
protected void |
accept(int acceptorID) |
LocalConnector.LocalEndPoint |
connect() |
LocalConnector.LocalEndPoint |
executeRequest(String rawRequest)
Execute a request and return the EndPoint through which
multiple responses can be received or more input provided.
|
ByteBuffer |
getResponse(ByteBuffer requestsBuffer)
Get a single response using a parser to search for the end of the message.
|
ByteBuffer |
getResponse(ByteBuffer requestBuffer,
boolean head,
long time,
TimeUnit unit)
Get a single response using a parser to search for the end of the message.
|
ByteBuffer |
getResponse(ByteBuffer requestBuffer,
long time,
TimeUnit unit)
Get a single response using a parser to search for the end of the message.
|
String |
getResponse(String rawRequest)
Get a single response using a parser to search for the end of the message.
|
String |
getResponse(String rawRequest,
boolean head,
long time,
TimeUnit unit)
Get a single response using a parser to search for the end of the message.
|
String |
getResponse(String rawRequest,
long time,
TimeUnit unit)
Get a single response using a parser to search for the end of the message.
|
ByteBuffer |
getResponses(ByteBuffer requestsBuffer)
Sends requests and get's responses based on thread activity.
|
ByteBuffer |
getResponses(ByteBuffer requestsBuffer,
long idleFor,
TimeUnit units)
Sends requests and get's responses based on thread activity.
|
String |
getResponses(String requests)
Sends requests and get responses based on thread activity.
|
String |
getResponses(String requests,
long idleFor,
TimeUnit units)
Sends requests and get responses based on thread activity.
|
Object |
getTransport() |
addConnectionFactory, addFirstConnectionFactory, addIfAbsentConnectionFactory, clearConnectionFactories, doStart, doStop, getAcceptorPriorityDelta, getAcceptors, getByteBufferPool, getConnectedEndPoints, getConnectionFactories, getConnectionFactory, getConnectionFactory, getDefaultConnectionFactory, getDefaultProtocol, getExecutor, getIdleTimeout, getName, getProtocols, getScheduler, getServer, handleAcceptFailure, interruptAcceptors, isAccepting, join, join, onEndPointClosed, onEndPointOpened, removeConnectionFactory, setAcceptorPriorityDelta, setConnectionFactories, setDefaultProtocol, setIdleTimeout, setName, shutdown, toString
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public LocalConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool pool, int acceptors, ConnectionFactory... factories)
public LocalConnector(Server server)
public LocalConnector(Server server, SslContextFactory sslContextFactory)
public LocalConnector(Server server, ConnectionFactory connectionFactory)
public LocalConnector(Server server, ConnectionFactory connectionFactory, SslContextFactory sslContextFactory)
public Object getTransport()
public String getResponses(String requests) throws Exception
This methods waits until the connection is closed or is idle for 5s before returning the responses.
Use getResponse(String)
for an alternative that does not wait for idle.
requests
- the requestsException
- if the requests failpublic String getResponses(String requests, long idleFor, TimeUnit units) throws Exception
This methods waits until the connection is closed or an idle period before returning the responses.
Use getResponse(String)
for an alternative that does not wait for idle.
requests
- the requestsidleFor
- The time the response stream must be idle for before returningunits
- The units of idleForException
- if the requests failpublic ByteBuffer getResponses(ByteBuffer requestsBuffer) throws Exception
This methods waits until the connection is closed or is idle for 5s before returning the responses.
Use getResponse(ByteBuffer)
for an alternative that does not wait for idle.
requestsBuffer
- the requestsException
- if the requests failpublic ByteBuffer getResponses(ByteBuffer requestsBuffer, long idleFor, TimeUnit units) throws Exception
This methods waits until the connection is closed or an idle period before returning the responses.
requestsBuffer
- the requestsidleFor
- The time the response stream must be idle for before returningunits
- The units of idleForException
- if the requests failpublic LocalConnector.LocalEndPoint executeRequest(String rawRequest)
rawRequest
- the requestpublic LocalConnector.LocalEndPoint connect()
protected void accept(int acceptorID) throws IOException, InterruptedException
accept
in class AbstractConnector
IOException
InterruptedException
public ByteBuffer getResponse(ByteBuffer requestsBuffer) throws Exception
requestsBuffer
- The request to sendException
- If there is a problempublic ByteBuffer getResponse(ByteBuffer requestBuffer, long time, TimeUnit unit) throws Exception
requestBuffer
- The request to sendtime
- The time to waitunit
- The units of the waitException
- If there is a problempublic ByteBuffer getResponse(ByteBuffer requestBuffer, boolean head, long time, TimeUnit unit) throws Exception
requestBuffer
- The request to sendhead
- True if the response is for a head requesttime
- The time to waitunit
- The units of the waitException
- If there is a problempublic String getResponse(String rawRequest) throws Exception
rawRequest
- The request to sendException
- If there is a problempublic String getResponse(String rawRequest, long time, TimeUnit unit) throws Exception
rawRequest
- The request to sendtime
- The time to waitunit
- The units of the waitException
- If there is a problempublic String getResponse(String rawRequest, boolean head, long time, TimeUnit unit) throws Exception
rawRequest
- The request to sendhead
- True if the response is for a head requesttime
- The time to waitunit
- The units of the waitException
- If there is a problemCopyright © 1995-2016 Webtide. All Rights Reserved.