Trouble with DHT21 / AM2301 heat humidity sensor

In short, setting up communication with java on a local network.
spark broadcasts a udp packet for which java listens to.
Java then takes the ip from that packet and setups a tcp connection.

This code works.

However getting the 2 codes to work together creates a red led.

Heres my communication