use of org.bitcoinj.core.PeerAddress in project bisq-core by bisq-network.
the class BtcNodeConverterTest method testConvertClearNode.
@Ignore
@Test
public void testConvertClearNode() {
final String ip = "192.168.0.1";
BtcNode node = mock(BtcNode.class);
when(node.getHostNameOrAddress()).thenReturn(ip);
PeerAddress peerAddress = new BtcNodeConverter().convertClearNode(node);
// noinspection ConstantConditions
InetAddress inetAddress = peerAddress.getAddr();
assertEquals(ip, inetAddress.getHostName());
}
use of org.bitcoinj.core.PeerAddress in project bisq-core by bisq-network.
the class PeerAddressesRepositoryTest method testGetPeerAddressesWhenOnionNodesOnly.
@Test
public void testGetPeerAddressesWhenOnionNodesOnly() {
BtcNode node = mock(BtcNode.class);
when(node.hasClearNetAddress()).thenReturn(true);
BtcNode onionNode = mock(BtcNode.class);
when(node.hasOnionAddress()).thenReturn(true);
BtcNodeConverter converter = mock(BtcNodeConverter.class, RETURNS_DEEP_STUBS);
PeerAddressesRepository repository = new PeerAddressesRepository(converter, Lists.newArrayList(node, onionNode));
List<PeerAddress> peers = repository.getPeerAddresses(mock(Socks5Proxy.class), false);
assertEquals(1, peers.size());
}
use of org.bitcoinj.core.PeerAddress in project bisq-core by bisq-network.
the class PeerAddressesRepositoryTest method testGetPeerAddressesWhenProxyAndClearNodes.
@Test
public void testGetPeerAddressesWhenProxyAndClearNodes() {
BtcNode node = mock(BtcNode.class);
when(node.hasClearNetAddress()).thenReturn(true);
BtcNode onionNode = mock(BtcNode.class);
when(node.hasOnionAddress()).thenReturn(true);
BtcNodeConverter converter = mock(BtcNodeConverter.class, RETURNS_DEEP_STUBS);
PeerAddressesRepository repository = new PeerAddressesRepository(converter, Lists.newArrayList(node, onionNode));
List<PeerAddress> peers = repository.getPeerAddresses(mock(Socks5Proxy.class), true);
assertEquals(2, peers.size());
}
use of org.bitcoinj.core.PeerAddress in project bisq-core by bisq-network.
the class PeerAddressesRepositoryTest method testGetPeerAddressesWhenClearNodes.
@Test
public void testGetPeerAddressesWhenClearNodes() {
BtcNode node = mock(BtcNode.class);
when(node.hasClearNetAddress()).thenReturn(true);
BtcNodeConverter converter = mock(BtcNodeConverter.class, RETURNS_DEEP_STUBS);
PeerAddressesRepository repository = new PeerAddressesRepository(converter, Collections.singletonList(node));
List<PeerAddress> peers = repository.getPeerAddresses(null, false);
assertFalse(peers.isEmpty());
}
Aggregations