com.amazon.redshift.plugin.httpserver

## Class Server

- java.lang.Object
- - com.amazon.redshift.plugin.httpserver.Server

    public class Server
    extends Object

Ad-hoc http server. Listen for one incoming connection or stop after timeout.

### Nested Class Summary

Nested Classes
`class` `Server.ListenerThread` Http worker thread.

### Constructor Summary

Constructors
Constructor and Description
`Server(int port, RequestHandler handler, Duration waitTime)` Ad-hoc http server.

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `getLocalPort()`
`void` `listen()` Actual start server to work.
`void` `stop()` Stops the server.
`void` `waitForResult()` Wait for http callback result.

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

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

### Constructor Detail

#### Server

    public Server(int port,
                  RequestHandler handler,
                  Duration waitTime)

Ad-hoc http server.

Parameters:
  `port` - to listen
  `handler` - functional callback. put all necessary functionality here
  `waitTime` - how long does server wait for interaction.

### Method Detail

#### getLocalPort

    public int getLocalPort()

#### listen

    public void listen()
                throws IOException

Actual start server to work.

Throws:
  `IOException` - all exceptions wrapped in `IOException`

#### waitForResult

    public void waitForResult()

Wait for http callback result. Block execution till result or timeout exited.

#### stop

    public void stop()

Stops the server.