mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-25 16:05:28 -04:00
Introduce network package and Peer abstraction
Prior to this change, TomP2P's 'PeerAddress' was used heavily throughout Bitsquare, effectively tying many parts of the system to the TomP2P API when they otherwise had no need to be aware of TomP2P at all. The Peer interface (and the new 'network' package to which it belongs) is designed to provide this missing abstraction and is a step toward isolating TomP2P functionality as completely as possible--so as to make the latter easy to test (and easy to replace if necessary). A very simple TomP2PPeer implementation of the Peer interface has been provided in the new 'network.tomp2p' package. It is currently just a wrapper for an underlying PeerAddress object, but it is reasonable to expect that more functionality will find its way into this class over time.
This commit is contained in:
parent
311e15c0e5
commit
00af59aa20
23 changed files with 175 additions and 87 deletions
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* This file is part of Bitsquare.
|
||||
*
|
||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.network.tomp2p;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class TomP2PPeerTest {
|
||||
|
||||
@Test
|
||||
public void testToString() {
|
||||
TomP2PPeer peer = new TomP2PPeer(null);
|
||||
assertThat(peer.toString(), equalTo("TomP2PPeer{peerAddress=null}"));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue