Skip to content

Commit d81d265

Browse files
Merge pull request #127 from marszub/crucialConnectionChanges
crucialConnectionChanges
2 parents 9867e97 + b6d5735 commit d81d265

File tree

2 files changed

+1
-26
lines changed

2 files changed

+1
-26
lines changed

src/main/java/pl/edu/agh/calculationp2p/network/connection/StaticConnection.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public void read(List messages) {
6060

6161
public void reconnect(){
6262
try {
63-
socketChannel = SocketChannel.open(ipAddress);
6463
socketChannel.configureBlocking(false);
64+
socketChannel = SocketChannel.open(ipAddress);
6565
try {
6666
super.register(selector);
6767
} catch (ClosedChannelException ignored) {

src/test/java/pl/edu/agh/calculationp2p/network/connection/StaticConnectionTest.java

-25
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,6 @@
1515

1616
public class StaticConnectionTest
1717
{
18-
@Test
19-
void testIfConnectionWillKeepItselfAliveAfterDisconnectRead() throws IOException {
20-
DummyMessage message = new DummyMessage("TESTMESSAGE");
21-
InetSocketAddress ip1 = new InetSocketAddress("localhost", 50000);
22-
InetSocketAddress ip2 = new InetSocketAddress("localhost", 50001);
23-
SelectorServerPair result1 = createServer(ip1);
24-
SelectorServerPair result2 = createServer(ip2);
25-
Selector selector1 = result1.selector();
26-
Selector selector2 = result2.selector();
27-
StaticConnection connection = new StaticConnection(ip2);
28-
connection.register(selector1);
29-
connection.send(message);
30-
DynamicConnection dynamicConnection = addNewConnection(selector2);
31-
dynamicConnection.close();
32-
getMessage(selector1);
33-
dynamicConnection = addNewConnection(selector2);
34-
dynamicConnection.send(message);
35-
assertEquals(message.serialize(), getMessage(selector1).get(0));
36-
selector1.close();
37-
selector2.close();
38-
connection.close();
39-
dynamicConnection.close();
40-
result1.server().close();
41-
result2.server().close();
42-
}
4318

4419
@Test
4520
void checkIfStaticConnectionReadsProperly() throws IOException

0 commit comments

Comments
 (0)