public static interface Client.Builder
Client
s. Create a builder with Client.builder()
.
The default built client connects securely via port 6697. See secure(boolean)
to disable, or the other secure-prefixed methods in this
builder to fully utilize the feature. Note that the default
TrustManagerFactory relies on your local trust store. The default Oracle
trust store does not accept self-signed certificates.
Modifier and Type | Method and Description |
---|---|
Client.Builder |
actorTracker(Function<Client.WithManagement,? extends ActorTracker> supplier)
Sets the supplier of the actor tracker.
|
Client.Builder |
authManager(Function<Client.WithManagement,? extends AuthManager> supplier)
Sets the supplier of the authentication manager.
|
Client.Builder |
bindHost(String host)
Binds the client to a host or IP locally.
|
Client.Builder |
bindPort(int port)
Binds the client to the specified port.
|
Client |
build()
Clientmaker, clientmaker, make me a client!
|
Client |
buildAndConnect()
Clientmaker, clientmaker, make me a client, build me the client,
begin connection!
|
Client.Builder |
capabilityManager(Function<Client.WithManagement,? extends CapabilityManager.WithManagement> supplier)
Sets the supplier of the capability manager.
|
Client.Builder |
defaultMessageMap(DefaultMessageMap defaultMessageMap)
Sets default messages.
|
Client.Builder |
eventManager(Function<Client.WithManagement,? extends EventManager> supplier)
Sets the supplier of the event manager.
|
Client.Builder |
exceptionListener(Consumer<Exception> listener)
Sets a listener for all thrown exceptions on this client.
|
Client.Builder |
inputListener(Consumer<String> listener)
Sets a listener for all incoming messages from the server.
|
Client.Builder |
iSupportManager(Function<Client.WithManagement,? extends ISupportManager> supplier)
Sets the supplier of the ISUPPORT manager.
|
Client.Builder |
messageSendingQueueSupplier(Function<Client.WithManagement,? extends MessageSendingQueue> supplier)
Sets the supplier of message sending queues, which dictate the
rate at which messages are sent by the Client to the server.
|
Client.Builder |
messageTagManager(Function<Client.WithManagement,? extends MessageTagManager> supplier)
Sets the supplier of the message tag manager.
|
Client.Builder |
name(String name)
Names the client, for internal labeling.
|
Client.Builder |
nick(String nick)
Sets the client's nick.
|
Client.Builder |
outputListener(Consumer<String> listener)
Sets a listener for all outgoing messages to the server.
|
Client.Builder |
realName(String name)
Sets the realname the client uses.
|
Client.Builder |
secure(boolean secure)
Sets whether the client connects via TLS/SSL.
|
Client.Builder |
secureKey(Path keyFile)
Sets the private key for SSL connection.
|
Client.Builder |
secureKeyCertChain(Path keyCertChainFile)
Sets the key for SSL connection.
|
Client.Builder |
secureKeyPassword(String password)
Sets the private key password for SSL connection.
|
Client.Builder |
secureTrustManagerFactory(TrustManagerFactory factory)
Sets the
TrustManagerFactory for SSL connection. |
Client.Builder |
serverHost(String host)
Sets the server host to which the client will connect.
|
Client.Builder |
serverInfo(Function<Client.WithManagement,? extends ServerInfo.WithManagement> supplier)
Sets the supplier of the server info.
|
Client.Builder |
serverPassword(String password)
Sets the server password.
|
Client.Builder |
serverPort(int port)
Sets the server port to which the client will connect.
|
Client.Builder |
stsStorageManager(StsStorageManager storageManager)
Sets the storage manager for STS (strict transport security) support.
|
Client.Builder |
user(String user)
Sets the user the client connects as.
|
Client.Builder |
webirc(String password,
String user,
String host,
InetAddress ip)
Sets all the information for, and enables, WebIRC.
|
Client.Builder |
webircRemove()
Removes WEBIRC settings from this builder.
|
@Nonnull Client.Builder actorTracker(@Nonnull Function<Client.WithManagement,? extends ActorTracker> supplier)
By default, the DefaultActorTracker
is used.
supplier
- supplierDefaultActorTracker
@Nonnull Client.Builder authManager(@Nonnull Function<Client.WithManagement,? extends AuthManager> supplier)
By default, the DefaultAuthManager
is used.
supplier
- supplierDefaultAuthManager
@Nonnull Client.Builder bindHost(@Nullable String host)
By default, the host is not set which results in wildcard binding.
host
- host to bind to, or null for wildcard binding@Nonnull Client.Builder bindPort(int port)
By default, the port is 0.
port
- port to bind to@Nonnull Client.Builder capabilityManager(@Nonnull Function<Client.WithManagement,? extends CapabilityManager.WithManagement> supplier)
By default, the DefaultCapabilityManager
is used.
supplier
- supplierDefaultCapabilityManager
@Nonnull Client.Builder defaultMessageMap(@Nonnull DefaultMessageMap defaultMessageMap)
defaultMessageMap
- default values for messagesDefaultMessageMap
@Nonnull Client.Builder eventManager(@Nonnull Function<Client.WithManagement,? extends EventManager> supplier)
By default, the DefaultEventManager
is used.
supplier
- supplierDefaultEventManager
@Nonnull Client.Builder exceptionListener(@Nullable Consumer<Exception> listener)
All exceptions are passed from a single, separate thread.
listener
- catcher of throwable objects or null to not listen@Nonnull Client.Builder inputListener(@Nullable Consumer<String> listener)
All messages are passed from a single, separate thread.
listener
- input listener or null to not listen@Nonnull Client.Builder iSupportManager(@Nonnull Function<Client.WithManagement,? extends ISupportManager> supplier)
By default, the DefaultISupportManager
is used.
supplier
- supplierDefaultEventManager
@Nonnull Client.Builder messageSendingQueueSupplier(@Nonnull Function<Client.WithManagement,? extends MessageSendingQueue> supplier)
By default, the SingleDelaySender
is used with a delay set
to SingleDelaySender.DEFAULT_MESSAGE_DELAY
.
supplier
- supplierMessageSendingQueue
@Nonnull Client.Builder messageTagManager(@Nonnull Function<Client.WithManagement,? extends MessageTagManager> supplier)
By default, the DefaultMessageTagManager
is used.
supplier
- supplierMessageTagManager
@Nonnull Client.Builder name(@Nonnull String name)
name
- a name to label the client internallyIllegalArgumentException
- if name is null@Nonnull Client.Builder nick(@Nonnull String nick)
By default, the nick is Kitteh.
nick
- nick for the client to useIllegalArgumentException
- if nick is null@Nonnull Client.Builder outputListener(@Nullable Consumer<String> listener)
All messages are passed from a single, separate thread.
listener
- output listener or null to not listen@Nonnull Client.Builder realName(@Nonnull String name)
By default, the realname is Kitteh.
name
- realname to useIllegalArgumentException
- for null realname@Nonnull Client.Builder serverPassword(@Nullable String password)
If not set, no password is sent
password
- server password or null to not send one@Nonnull Client.Builder secure(boolean secure)
Note that by default the TrustManager used does not accept the
certificates of many popular networks. You must use secureTrustManagerFactory(TrustManagerFactory)
to set your own
TrustManagerFactory.
secure
- true for TLS/SSL@Nonnull Client.Builder secureKeyCertChain(@Nullable Path keyCertChainFile)
keyCertChainFile
- X.509 certificate chain file in PEM formatsecure(boolean)
@Nonnull Client.Builder secureKey(@Nullable Path keyFile)
keyFile
- PKCS#8 private key file in PEM formatsecure(boolean)
@Nonnull Client.Builder secureKeyPassword(@Nullable String password)
password
- password for private keysecure(boolean)
@Nonnull Client.Builder secureTrustManagerFactory(@Nullable TrustManagerFactory factory)
TrustManagerFactory
for SSL connection.factory
- trust manager suppliersecure(boolean)
@Nonnull Client.Builder serverHost(@Nonnull String host)
By default, the host is localhost.
host
- IRC server hostIllegalArgumentException
- for null host@Nonnull Client.Builder serverPort(int port)
By default, the port is 6667.
port
- IRC server port@Nonnull Client.Builder serverInfo(@Nonnull Function<Client.WithManagement,? extends ServerInfo.WithManagement> supplier)
By default, the DefaultServerInfo
is used.
supplier
- supplierDefaultServerInfo
@Nonnull Client.Builder user(@Nonnull String user)
By default, the user is Kitteh.
user
- user to connect asIllegalArgumentException
- for null user@Nonnull Client.Builder webirc(@Nonnull String password, @Nonnull String user, @Nonnull String host, @Nonnull InetAddress ip)
By default, WebIRC is disabled.
password
- password as defined in the IRCd configuser
- username part of the client's addresshost
- hostname part of the client's addressip
- client's IP addressIllegalArgumentException
- for any null parameterswebircRemove()
@Nonnull Client.Builder webircRemove()
webirc(String, String, String, InetAddress)
@Nonnull Client.Builder stsStorageManager(@Nullable StsStorageManager storageManager)
By default, this is null and thus STS support is disabled. If you elect to enable STS, you are not permitted to use an insecure trust manager factory.
storageManager
- storage system to persist STS information per host@Nonnull Client build()
Copyright © 2013–2019 Kitteh. All rights reserved.