Class LocalConnector
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.server.AbstractConnector
org.eclipse.jetty.server.LocalConnector
- All Implemented Interfaces:
Connector, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, Graceful, LifeCycle
A local connector, mostly for testing purposes.
HttpTester.Request request = HttpTester.newRequest();
request.setURI("/some/resource");
HttpTester.Response response =
HttpTester.parseResponse(HttpTester.from(localConnector.getResponse(request.generate())));
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface Dumpable
Dumpable.DumpableContainerNested classes/interfaces inherited from interface Graceful
Graceful.Shutdown, Graceful.ThrowingRunnableNested classes/interfaces inherited from interface LifeCycle
LifeCycle.Listener -
Field Summary
Fields inherited from class AbstractConnector
LOG -
Constructor Summary
ConstructorsConstructorDescriptionLocalConnector(Server server) LocalConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, int acceptors, ConnectionFactory... factories) LocalConnector(Server server, ConnectionFactory connectionFactory) LocalConnector(Server server, ConnectionFactory connectionFactory, SslContextFactory.Server sslContextFactory) LocalConnector(Server server, SslContextFactory.Server sslContextFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaccept(int acceptorID) connect()executeRequest(String rawRequest) Execute a request and return the EndPoint through which multiple responses can be received or more input provided.getResponse(String rawRequest) Get a single response using a parser to search for the end of the message.getResponse(String rawRequest, boolean head, long time, TimeUnit unit) Get a single response using a parser to search for the end of the message.getResponse(String rawRequest, long time, TimeUnit unit) Get a single response using a parser to search for the end of the message.getResponse(ByteBuffer requestsBuffer) Get a single response using a parser to search for the end of the message.getResponse(ByteBuffer requestBuffer, boolean head, long time, TimeUnit unit) Get a single response using a parser to search for the end of the message.getResponse(ByteBuffer requestBuffer, long time, TimeUnit unit) Get a single response using a parser to search for the end of the message.Get the underlying socket, channel, buffer etc. for the connector..Methods inherited from class AbstractConnector
addConnectionFactory, addFirstConnectionFactory, addIfAbsentConnectionFactory, clearConnectionFactories, doStart, doStop, getAcceptorPriorityDelta, getAcceptors, getByteBufferPool, getConnectedEndPoints, getConnectionFactories, getConnectionFactory, getConnectionFactory, getDefaultConnectionFactory, getDefaultProtocol, getExecutor, getIdleTimeout, getName, getProtocols, getScheduler, getServer, getShutdownIdleTimeout, handleAcceptFailure, interruptAcceptors, isAccepting, isShutdown, join, join, onEndPointClosed, onEndPointOpened, removeConnectionFactory, setAccepting, setAcceptorPriorityDelta, setConnectionFactories, setDefaultProtocol, setIdleTimeout, setName, setShutdownIdleTimeout, shutdown, toStringMethods inherited from class ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Container
addBean, addBean, addEventListener, getBean, getBeans, getBeans, getCachedBeans, getContainedBeans, getEventListeners, isManaged, manage, removeBean, removeEventListener, unmanageMethods inherited from interface Dumpable.DumpableContainer
isDumpableMethods inherited from interface LifeCycle
addEventListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, start, stop
-
Constructor Details
-
LocalConnector
public LocalConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, int acceptors, ConnectionFactory... factories) -
LocalConnector
-
LocalConnector
-
LocalConnector
-
LocalConnector
public LocalConnector(Server server, ConnectionFactory connectionFactory, SslContextFactory.Server sslContextFactory)
-
-
Method Details
-
getTransport
-
executeRequest
Execute a request and return the EndPoint through which multiple responses can be received or more input provided.- Parameters:
rawRequest- the request- Returns:
- the local endpoint
-
connect
-
accept
- Specified by:
acceptin classAbstractConnector- Throws:
InterruptedException
-
getResponse
Get a single response using a parser to search for the end of the message.- Parameters:
requestsBuffer- The request to send- Returns:
- ByteBuffer containing response or null.
- Throws:
Exception- If there is a problem
-
getResponse
Get a single response using a parser to search for the end of the message.- Parameters:
requestBuffer- The request to sendtime- The time to waitunit- The units of the wait- Returns:
- ByteBuffer containing response or null.
- Throws:
Exception- If there is a problem
-
getResponse
public ByteBuffer getResponse(ByteBuffer requestBuffer, boolean head, long time, TimeUnit unit) throws Exception Get a single response using a parser to search for the end of the message.- Parameters:
requestBuffer- The request to sendhead- True if the response is for a head requesttime- The time to waitunit- The units of the wait- Returns:
- ByteBuffer containing response or null.
- Throws:
Exception- If there is a problem
-
getResponse
-
getResponse
Get a single response using a parser to search for the end of the message.- Parameters:
rawRequest- The request to sendtime- The time to waitunit- The units of the wait- Returns:
- ByteBuffer containing response or null.
- Throws:
Exception- If there is a problem
-
getResponse
public String getResponse(String rawRequest, boolean head, long time, TimeUnit unit) throws Exception Get a single response using a parser to search for the end of the message.- Parameters:
rawRequest- The request to sendhead- True if the response is for a head requesttime- The time to waitunit- The units of the wait- Returns:
- ByteBuffer containing response or null.
- Throws:
Exception- If there is a problem
-