Skip to content

Commit

Permalink
Fix an end of stream bug
Browse files Browse the repository at this point in the history
Closed the output stream to inform the SA for end of data.
  • Loading branch information
mecseid committed Apr 3, 2018
1 parent c5e6aee commit a51c643
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>hu.alphabox</groupId>
<artifactId>spamc</artifactId>
<version>0.1-SNAPSHOT</version>
<version>0.2.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>spamc</name>
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/hu/alphabox/spamc/SAClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ public SAResponse sendRequest(SARequest request) throws SAException, IOException
InputStream inputStream = socket.getInputStream();

StringBuilder builder = new StringBuilder();
outputStream.write(request.getRequestByteArray().toByteArray());
outputStream.flush();

request.getRequestByteArray().writeTo(outputStream);
socket.shutdownOutput();

byte[] cache = new byte[1024];
while (inputStream.read(cache) != -1) {
Expand Down

0 comments on commit a51c643

Please sign in to comment.