public class PaymentChannelServerListener extends Object
PaymentChannelServer
.Modifier and Type | Class and Description |
---|---|
static interface |
PaymentChannelServerListener.HandlerFactory
A factory which generates connection-specific event handlers.
|
Constructor and Description |
---|
PaymentChannelServerListener(TransactionBroadcaster broadcaster,
Wallet wallet,
int timeoutSeconds,
Coin minAcceptedChannelSize,
PaymentChannelServerListener.HandlerFactory eventHandlerFactory)
Sets up a new payment channel server which listens on the given port.
|
Modifier and Type | Method and Description |
---|---|
void |
bindAndStart(int port)
Binds to the given port and starts accepting new client connections.
|
void |
close()
Closes all client connections currently connected gracefully.
|
public PaymentChannelServerListener(TransactionBroadcaster broadcaster, Wallet wallet, int timeoutSeconds, Coin minAcceptedChannelSize, PaymentChannelServerListener.HandlerFactory eventHandlerFactory) throws IOException
broadcaster
- The PeerGroup on which transactions will be broadcast - should have multiple connections.wallet
- The wallet which will be used to complete transactionstimeoutSeconds
- The read timeout between messages. This should accommodate latency and client ECDSA
signature operations.minAcceptedChannelSize
- The minimum amount of coins clients must lock in to create a channel. Clients which
are unwilling or unable to lock in at least this value will immediately disconnect.
For this reason, a fairly conservative value (in terms of average value spent on a
channel) should generally be chosen.eventHandlerFactory
- A factory which generates event handlers which are created for each new connectionIOException
public void bindAndStart(int port) throws Exception
Exception
- If binding to the given port fails (eg SocketException: Permission denied for privileged ports)public void close()
Closes all client connections currently connected gracefully.
Note that this does not settle the actual payment channels (and broadcast payment transactions), which
must be done using the StoredPaymentChannelServerStates
which manages the states for the associated
wallet.
Copyright © 2016. All rights reserved.