diff --git a/core/src/main/java/org/bitcoinj/net/BlockingClient.java b/core/src/main/java/org/bitcoinj/net/BlockingClient.java index fc0873e001f..65b8cd30df7 100644 --- a/core/src/main/java/org/bitcoinj/net/BlockingClient.java +++ b/core/src/main/java/org/bitcoinj/net/BlockingClient.java @@ -149,10 +149,11 @@ public synchronized void writeBytes(byte[] message) throws IOException { OutputStream stream = socket.getOutputStream(); stream.write(message); stream.flush(); + } else { + log.warn("Attempted to write to a closed socket."); } } catch (IOException e) { - if(!(e instanceof SocketException && e.toString().equals("Socket is closed"))) - log.error("Error writing message to connection, closing connection", e); + log.error("Error writing message to connection, closing connection", e); closeConnection(); throw e; }