use of bisq.core.btc.wallet.BtcNodeConverter.Facade in project bisq-core by bisq-network.
the class BtcNodeConverterTest method testConvertOnionHostOnFailure.
@Test
public void testConvertOnionHostOnFailure() throws UnknownHostException {
BtcNode node = mock(BtcNode.class);
when(node.getOnionAddress()).thenReturn("aaa.onion");
Facade facade = mock(Facade.class);
when(facade.onionHostToInetAddress(any())).thenThrow(UnknownHostException.class);
PeerAddress peerAddress = new BtcNodeConverter(facade).convertOnionHost(node);
assertNull(peerAddress);
}
use of bisq.core.btc.wallet.BtcNodeConverter.Facade in project bisq-core by bisq-network.
the class BtcNodeConverterTest method testConvertOnionHost.
@Test
public void testConvertOnionHost() throws UnknownHostException {
BtcNode node = mock(BtcNode.class);
when(node.getOnionAddress()).thenReturn("aaa.onion");
InetAddress inetAddress = mock(InetAddress.class);
Facade facade = mock(Facade.class);
when(facade.onionHostToInetAddress(any())).thenReturn(inetAddress);
PeerAddress peerAddress = new BtcNodeConverter(facade).convertOnionHost(node);
// noinspection ConstantConditions
assertEquals(inetAddress, peerAddress.getAddr());
}
use of bisq.core.btc.wallet.BtcNodeConverter.Facade in project bisq-core by bisq-network.
the class BtcNodeConverterTest method testConvertWithTor.
@Test
public void testConvertWithTor() throws DnsLookupException {
InetAddress expected = mock(InetAddress.class);
Facade facade = mock(Facade.class);
when(facade.torLookup(any(), anyString())).thenReturn(expected);
BtcNode node = mock(BtcNode.class);
when(node.getHostNameOrAddress()).thenReturn("aaa.onion");
PeerAddress peerAddress = new BtcNodeConverter(facade).convertWithTor(node, mock(Socks5Proxy.class));
// noinspection ConstantConditions
assertEquals(expected, peerAddress.getAddr());
}
Aggregations