Skip to content

Commit

Permalink
testConn #527
Browse files Browse the repository at this point in the history
  • Loading branch information
yanhuqing666 committed May 3, 2018
1 parent 8422ab5 commit 5b40da6
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.io.*;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;

/**
Expand Down Expand Up @@ -101,6 +102,11 @@ public boolean testConnection(String schema) throws IOException {
BinaryPacket bin1 = new BinaryPacket();
bin1.read(in);

if (bin1.getData()[0] == ErrorPacket.FIELD_COUNT) {
ErrorPacket err = new ErrorPacket();
err.read(bin1);
throw new RuntimeException(new String(err.getMessage(), StandardCharsets.UTF_8));
}
HandshakeV10Packet handshake = new HandshakeV10Packet();
handshake.read(bin1);

Expand Down

0 comments on commit 5b40da6

Please sign in to comment.