Skip to content

Client setup

DataSecs edited this page Feb 16, 2018 · 2 revisions

Let's step ahead and setup up the client! (Please consider reading the server setup instructions first, in case you landed here by accident!)

Step One:

And again take a look at the raw base for the setup:

HydraClient client = new Client.Builder("localhost", 8888, new SampleProtocol())
                .workerThreads(4)
                .option(StandardSocketOptions.TCP_NODELAY, true)
                .build();

The builder-pattern (method-chaining) was again used for the client, but now it returns an instance of the class HydraClient. The constructor again takes three obligatory parameters. The part where the third parameter the protocol is elaborated: the protocol

Step Two:

As you might notice the client doesn't have boss threads, just worker threads. The standard amount of worker threads is set to two. Also there is no option to set child options for the connection, as those are handled by the server. For more information take a look at the Client class. In this class are all the configurations explained using Javadocs.

Step Three:

Step three doesn't differ from the Server setup, as the syntax is exactly the same.

This setup is much shorter than the server setup, as most information was already provided in the server setup instructions. Next instruction is about Sessions. You might want to check out the other methods the HydraClient class has to offer.

Clone this wiki locally