|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.bitcoin.protocols.channels.PaymentChannelServerListener
public class PaymentChannelServerListener
Implements a listening TCP server that can accept connections from payment channel clients, and invokes the provided
event listeners when new channels are opened or payments arrive. This is the highest level class in the payment
channels API. Internally, sends protobuf messages to/from a newly created PaymentChannelServer.
| Nested Class Summary | |
|---|---|
static interface |
PaymentChannelServerListener.HandlerFactory
A factory which generates connection-specific event handlers. |
| Constructor Summary | |
|---|---|
PaymentChannelServerListener(TransactionBroadcaster broadcaster,
Wallet wallet,
int timeoutSeconds,
BigInteger minAcceptedChannelSize,
PaymentChannelServerListener.HandlerFactory eventHandlerFactory)
Sets up a new payment channel server which listens on the given port. |
|
| Method Summary | |
|---|---|
void |
bindAndStart(int port)
Binds to the given port and starts accepting new client connections. |
void |
close()
Closes all client connections currently connected gracefully. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PaymentChannelServerListener(TransactionBroadcaster broadcaster,
Wallet wallet,
int timeoutSeconds,
BigInteger 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 connection
IOException| Method Detail |
|---|
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||