Package ch.bitagent.bitcoin.lib.network
Class SimpleNode
- java.lang.Object
-
- ch.bitagent.bitcoin.lib.network.SimpleNode
-
public class SimpleNode extends Object
SimpleNode class.
-
-
Constructor Summary
Constructors Constructor Description SimpleNode(String host, Integer port, Boolean testnet, Boolean logging)Constructor for SimpleNode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()close.byte[]handshake()Do a handshake with the other node.NetworkEnveloperead()Read a message from the socketvoidsend(Message message)Send a message to the connected nodeNetworkEnvelopewaitFor(Set<String> commands)Wait for one of the messages in the list
-
-
-
Method Detail
-
close
public void close()
close.
-
handshake
public byte[] handshake()
Do a handshake with the other node. Handshake is sending a version message and getting a verack back.- Returns:
- an array of
byteobjects
-
send
public void send(Message message)
Send a message to the connected node- Parameters:
message- aMessageobject
-
read
public NetworkEnvelope read()
Read a message from the socket- Returns:
- a
NetworkEnvelopeobject
-
waitFor
public NetworkEnvelope waitFor(Set<String> commands)
Wait for one of the messages in the list- Parameters:
commands- aSetobject- Returns:
- a
NetworkEnvelopeobject
-
-