Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed protocol to do the following: ``` Client: 0x6060 B017 Client: <option a> <option b> <option c> <option d> Server: <chosen option> ```
- Loading branch information
1 parent
ddeada0
commit 80da2e1
Showing
11 changed files
with
176 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
community/bolt/src/test/java/org/neo4j/bolt/v1/transport/integration/ConnectionIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright (c) 2002-2015 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program 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 General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.bolt.v1.transport.integration; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.ExpectedException; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
|
||
import java.io.IOException; | ||
import java.util.Collection; | ||
|
||
import org.neo4j.bolt.v1.transport.socket.client.Connection; | ||
import org.neo4j.bolt.v1.transport.socket.client.SecureSocketConnection; | ||
import org.neo4j.bolt.v1.transport.socket.client.SecureWebSocketConnection; | ||
import org.neo4j.helpers.HostnamePort; | ||
|
||
import static java.util.Arrays.asList; | ||
|
||
@RunWith(Parameterized.class) | ||
public class ConnectionIT | ||
{ | ||
@Rule | ||
public ExpectedException exception = ExpectedException.none(); | ||
@Rule | ||
public Neo4jWithSocket server = new Neo4jWithSocket(); | ||
|
||
@Parameterized.Parameter(0) | ||
public Connection connection; | ||
|
||
@Parameterized.Parameter(1) | ||
public HostnamePort address; | ||
|
||
@Parameterized.Parameters | ||
public static Collection<Object[]> transports() | ||
{ | ||
return asList( | ||
new Object[]{ | ||
new SecureSocketConnection(), | ||
new HostnamePort( "localhost:7687" ) | ||
}, | ||
new Object[]{ | ||
new SecureWebSocketConnection(), | ||
new HostnamePort( "localhost:7688" ) | ||
} ); | ||
} | ||
|
||
@Test | ||
public void shouldCloseConnectionOnInvalidHandshake() throws Exception | ||
{ | ||
// GIVEN | ||
connection.connect( address); | ||
|
||
|
||
// WHEN | ||
connection.send( new byte[]{(byte)0xDE, (byte) 0xAD, (byte) 0xB0, (byte) 0x17, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ); | ||
|
||
// THEN | ||
exception.expect( IOException.class ); | ||
connection.recv( 4 ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.